I am writing a program that uses the Python graph-tool
library, and I have had luck using a radial tree layout with graph_tool.draw.radial_tree_layout(g,vertexes[0])
. However, there are several segments of my graph that are cut off from the rest and have no edges leading to any parts of the graph that I want. When I draw the graph, the disconnected nets get put into the middle, on top of he vertex that I want to be central. Therefore, I need an algorithm that will either remove these vertexes that have no route to vertexes[0]
, or a function to put them somewhere else on the graph, out of the way.
Asked
Active
Viewed 862 times
2

TheDoctor
- 1,450
- 2
- 17
- 28
1 Answers
0
And I figured it out:
(I was pulling from an SQLite database)
c.execute('SELECT * FROM connections')
ucon = c.fetchall()
lastlevel = ['Philosophy']
nextlevel = []
pcon = []
while lastlevel != []:
for i in ucon:
if i[1] in lastlevel:
nextlevel.append(i[0])
pcon.append(i)
lastlevel = nextlevel
nextlevel = []
Each line in the SQLite db was a tuple of start point and end point for a spanning edge. This isn't very efficient, but it does work well!

TheDoctor
- 1,450
- 2
- 17
- 28