1

I have a list with graphics. Some of elements in the list are None type, how can I display all elements from that list on one picture?

miastaPolozenie={{69, 94}, {16, 77}, {32, 11}, {24, 20}, {34, 53}}
counter=1   
grafiki=Table[None, {i, 1, liczbaMiast*liczbaMiast}]
polaczone={{1, 1, 1, 1, 0}, {1, 1, 1, 1, 0}, {1, 1, 1, 1, 0}, {1, 1, 1, 1, 1}, {0, 0, 0, 1, 1}}
For[i = 1, i < liczbaMiast, i++,
    For[j = 1, j < liczbaMiast, j++; counter++,
        If[polaczone[[i, j]] == 1, 
         grafiki[[counter]] = 
         Graphics[Line[{miastaPolozenie[[i]], miastaPolozenie[[j]]}]]]]]

I want to show all elements from 'grafiki'. I hope this is enough, names are not in English, if you need more information, let me know.

Janusz
  • 11
  • 2

1 Answers1

3

It appears that you are trying to visualize a graph based on an adjacency matrix.

The simplest way to merely visualize it is

GraphPlot[polaczone, VertexCoordinates -> miastaPolozenie, VertexSize -> 0.2]

If you want to manipulate the graph, build a Graph.

AdjacencyGraph[polaczone, VertexCoordinates -> miastaPolozenie]

You can remove self-loops with SimpleGraph.

Szabolcs
  • 234,956
  • 30
  • 623
  • 1,263