@paullee I would start at the end result and work your way back.
This is a visualisation of a network graph (it's the building I evolved during my presentation):
..the image itself is generated from a text file by the GraphViz tool with a command like this:
neato -Tsvg -Gpage="4,4" -Gsize="4,4" -Gratio=fill -Gcenter=1 < graph.dot > graph.svg
The input text file used by GraphViz is a good example of how you describe an undirected (possibly cyclic) graph. There are two types of objects defined: nodes, and edges between nodes:
strict graph G {
label="15aee6eef927b01955152d43aa8504d5";
graph [overlap=false];
"0/ll\nOutside" [color="#ddddff",style=filled];
"0/rl\nLiving" [color="#99ff99",style=filled];
"0/lr\nKitchen" [color="#9999ff",style=filled];
"0/rr\nCirculation" [color="#ffff99",style=filled];
"0/rr\nCirculation"--"1/rr\nCirculation" [label="Stair",style=dashed];
"1/rr\nCirculation"--"2/rr\nCirculation" [label="Stair",style=dashed];
"0/rr\nCirculation"--"0/ll\nOutside" [label="2.9"];
"0/rl\nLiving"--"0/lr\nKitchen" [label="4.3"];
"0/ll\nOutside"--"0/lr\nKitchen" [label="2.8"];
"0/rl\nLiving"--"0/rr\nCirculation" [label="4.0"];
"0/ll\nOutside"--"0/c\nStreet" [label="Entry"];
"0/rr\nCirculation"--"0/ll\nOutside" [label="Entry"];
"1/rl\nBedroom" [color="#ff9999",style=filled];
"1/lr\nOutside" [color="#ddddff",style=filled];
"1/rr\nCirculation" [color="#ffff99",style=filled];
"1/ll\nToilet" [color="#ff99ff",style=filled];
"1/rr\nCirculation"--"1/ll\nToilet" [label="2.9"];
"1/rl\nBedroom"--"1/lr\nOutside" [label="4.3"];
"1/rl\nBedroom"--"1/rr\nCirculation" [label="4.0"];
"2/ll\nOutside" [color="#ddddff",style=filled];
"2/rl\nBedroom" [color="#ff9999",style=filled];
"2/rr\nCirculation" [color="#ffff99",style=filled];
"2/ll\nOutside"--"2/rr\nCirculation" [label="2.9"];
"2/rr\nCirculation"--"2/rl\nBedroom" [label="4.0"];
}
It appears that the way you model a network graph in python is very similar. The advantage of using a graphing library is that you can query the graph: check it for cycles or unconnected nodes, find the shortest distance between nodes etc..