Skip to main content

reckoner reckoner's Library tagged graphs   View Popular

02 Jul 09

networkx.draw — NetworkX v0.99 documentation

  • node_shape: node shape (default=’o’), or ‘so^>v<dph8’ see pylab.scatter
29 Jan 09

subclassing Graph and dealing with subgraph - networkx-discuss | Google Groups

  • from networkx import Graph

    class FooGraph(Graph):
        def __init__(self,**kwds):
            Graph.__init__(self,kwds)
            self.a=10

    then,

07 Jan 09

Dijkstra's algorithm for shortest paths « ActiveState Code

  • Dijkstra(G,s) finds all shortest paths from s to each other vertex in the graph, and shortestPath(G,s,t) uses Dijkstra to find the shortest path from s to t. Uses the priorityDictionary data structure (Recipe 117228) to keep track of estimated distances to each vertex.
02 Nov 08

draw overlaid subgraphs? - networkx-discuss | Google Groups

02 Jun 08

XGraph plot dot showing multiple edges - networkx-discuss | Google Groups

  • For example edge labels can be added using matplotlib "text" objects
    like this:

    import networkx as nx
    import pylab as plot

    K=nx.XGraph(name="Konigsberg", multiedges=True, selfloops=False)
    K.add_edges_from([("A","B","Honey Bridge"),
        ("A","B","Blacksmith's Bridge"),
        ("A","C","Green Bridge"),
        ("A","C","Connecting Bridge"),
        ("A","D","Merchant's Bridge"),
        ("C","D","High Bridge"),
        ("B","D","Wooden Bridge")])

    pos=nx.spring_layout(K)
    nx.draw_nx(K,pos)
    xa,ya=pos['A']
    xb,yb=pos['B']
    plot.text((xa+xb)/2,(ya+yb)/2,"Blacksmith's Bridge")
    plot.show()

    With a little work you can get the label rotated and exactly how you
    want it positioned.  You can also set the node positions directly in the
    "pos" dictionary above.

1 - 20 of 29 Next ›
Showing 20 items per page

Highlighter, Sticky notes, Tagging, Groups and Network: integrated suite dramatically boosting research productivity. Learn more »

Join Diigo