Often the data that we import in GUESS is in such a form that to look at every node and edge distinctly we need to do lot of repositioning and have to set many features so that the graph look elegant in terms of its visualization.
Here is a quick fix to this problem. In the following script i am going to set the node color, edge color, size of nodes,label visibility, label color, the layout of the graph, and most importantly if you are working with the weighted graph, i am going to make the width of the edges of the graph proportional to their corresponding weight. Also in case of signed graph the color of the positive edges and the negative edges will be distinct which will make it easy for you to recognize them at once.
def modify_graph():
edgeset=g.getEdges()
if edgeset.size()>0:
edgeset1=g.getEdges()
maxweight=-1000
minweight=1000
i=0
rescaleLayout(1280,800)
for i in edgeset:
i.labelvisible=false
i.labelcolor=black
if i.weight>0:
i.color=limegreen
else:
i.color=red
edgeset1.remove(i)
for i in range (edgeset1.size()):
if edgeset1[i].weight<minweight:
minweight=edgeset1[i].weight
if edgeset1[i].weight>maxweight:
maxweight=edgeset1[i].weight
diff=maxweight-minweight
x=1.0
max=0
x=.01
while max<=10:
max=maxweight*x
x=x+.01
i=0
for i in range (edgeset1.size()):
edgeset1[i].width=(edgeset1[i].weight*x)
nodeset=g.getNodes()
for n in nodeset:
n.width = 20
n.height = 20
n.labelvisible=true
n.labelcolor=black
n.color=black
n.style = 2
g.kkLayout()
modify_graph()
Here is a quick fix to this problem. In the following script i am going to set the node color, edge color, size of nodes,label visibility, label color, the layout of the graph, and most importantly if you are working with the weighted graph, i am going to make the width of the edges of the graph proportional to their corresponding weight. Also in case of signed graph the color of the positive edges and the negative edges will be distinct which will make it easy for you to recognize them at once.
def modify_graph():
edgeset=g.getEdges()
if edgeset.size()>0:
edgeset1=g.getEdges()
maxweight=-1000
minweight=1000
i=0
rescaleLayout(1280,800)
for i in edgeset:
i.labelvisible=false
i.labelcolor=black
if i.weight>0:
i.color=limegreen
else:
i.color=red
edgeset1.remove(i)
for i in range (edgeset1.size()):
if edgeset1[i].weight<minweight:
minweight=edgeset1[i].weight
if edgeset1[i].weight>maxweight:
maxweight=edgeset1[i].weight
diff=maxweight-minweight
x=1.0
max=0
x=.01
while max<=10:
max=maxweight*x
x=x+.01
i=0
for i in range (edgeset1.size()):
edgeset1[i].width=(edgeset1[i].weight*x)
nodeset=g.getNodes()
for n in nodeset:
n.width = 20
n.height = 20
n.labelvisible=true
n.labelcolor=black
n.color=black
n.style = 2
g.kkLayout()
modify_graph()
hello:
ReplyDeleteIm using guess 1.03 and i have a problem doing an animation.....the command startMovie(...) throws a Exception...can you help me with that? thanks