Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Graph Theory

Reply
Thread Tools

Graph Theory

 
 
diffuser78@gmail.com
Guest
Posts: n/a
 
      10-05-2006
Is there any library in Python which has implementation of graph
theoretic algorithms and models ?

 
Reply With Quote
 
 
 
 
bearophileHUGS@lycos.com
Guest
Posts: n/a
 
      10-05-2006
:
> Is there any library in Python which has implementation of graph
> theoretic algorithms and models ?


There are many of them, like:
https://networkx.lanl.gov/
Mine:
http://sourceforge.net/projects/pynetwork/
....and some other.

Bye,
bearophile

 
Reply With Quote
 
 
 
 
diffuser78@gmail.com
Guest
Posts: n/a
 
      10-05-2006
Thanks for your quick reply. Since I have not read the documentation, I
was wondering if you can generate random graph and analyze some
peroperties of it like clustering coefficient or graph density. I am a
graph theory student and want to use python for development. Somebody
told me that Python has already so much bultin. Are there any
visualization tool which would depict the random graph generated by the
libraries.

Thanks for any kind of input.


wrote:
> :
> > Is there any library in Python which has implementation of graph
> > theoretic algorithms and models ?

>
> There are many of them, like:
> https://networkx.lanl.gov/
> Mine:
> http://sourceforge.net/projects/pynetwork/
> ...and some other.
>
> Bye,
> bearophile


 
Reply With Quote
 
Scott David Daniels
Guest
Posts: n/a
 
      10-05-2006
wrote:
> Are there any visualization tool which would depict the random graph
> generated by the libraries.


Google for DOT (.DOT format w/ renders to a variety of output formats).

--
--Scott David Daniels

 
Reply With Quote
 
bearophileHUGS@lycos.com
Guest
Posts: n/a
 
      10-05-2006
:
>I was wondering if you can generate random graph and analyze some
> peroperties of it like clustering coefficient or graph density.


There are many kinds of random graphs, in that Graph lib I have added
few random generators, but you can add many more yourself, it's easy
(Then if you want you can send them back to be added to that lib, if
they are nice). Note that if you want to manage a LOT of nodes/arcs you
can use Boost Graph with Python.


> I am a graph theory student and want to use python for development.


It can be useful for small and medium sized graphs.


> Somebody told me that Python has already so much bultin.


Right.


> Are there any visualization tool which would depict the random graph
> generated by the libraries.


Graph exports in two common formats, like Dot and another. NetworkX
probably exports in Dot too. Look for Graphviz. And there is another
famous sofeware for huge graphs too.

Bye,
bearophile

 
Reply With Quote
 
boggom@comcast.net
Guest
Posts: n/a
 
      10-05-2006

wrote:
> Thanks for your quick reply. Since I have not read the documentation, I
> was wondering if you can generate random graph and analyze some
> peroperties of it like clustering coefficient or graph density. I am a
> graph theory student and want to use python for development. Somebody
> told me that Python has already so much bultin. Are there any
> visualization tool which would depict the random graph generated by the
> libraries.


networkx has several random graph generators, including:

barabasi_albert_graph
binomial_graph
erdos_renyi_graph
gnm_random_graph
gnp_random_graph
random_regular_graph
watts_strogatz_graph

and others (e.g. via configuration_model)

For drawing you can use pygraphviz (also available at
networkx.lanl.gov)
or the built-in drawing tools.

e.g.

>>> from networkx import *
>>> no_nodes=1000
>>> for p in [ 0.1, 0.2, 0.3]:
>>> g = watts_strogatz_graph(no_nodes, 4, p)
>>> print density(g), average_clustering(g)


be warned that drawing large random graphs are not overly insightful

check the examples

 
Reply With Quote
 
James Stroud
Guest
Posts: n/a
 
      10-05-2006
wrote:
> Is there any library in Python which has implementation of graph
> theoretic algorithms and models ?
>


I don't know much about graph theory, but a coworker who does a lot of
it mentioned something about boost:

http://www.boost.org/libs/graph/doc/python.html


James

--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095

http://www.jamesstroud.com/
 
Reply With Quote
 
diffuser78@gmail.com
Guest
Posts: n/a
 
      10-06-2006
Thanks for all your responses.

 
Reply With Quote
 
diffuser78@gmail.com
Guest
Posts: n/a
 
      10-06-2006
Is there any documentation avaialbe for networkx ? I want to have an
implementation of random graphs including watts and strogatz graph.

wrote:
> wrote:
> > Thanks for your quick reply. Since I have not read the documentation, I
> > was wondering if you can generate random graph and analyze some
> > peroperties of it like clustering coefficient or graph density. I am a
> > graph theory student and want to use python for development. Somebody
> > told me that Python has already so much bultin. Are there any
> > visualization tool which would depict the random graph generated by the
> > libraries.

>
> networkx has several random graph generators, including:
>
> barabasi_albert_graph
> binomial_graph
> erdos_renyi_graph
> gnm_random_graph
> gnp_random_graph
> random_regular_graph
> watts_strogatz_graph
>
> and others (e.g. via configuration_model)
>
> For drawing you can use pygraphviz (also available at
> networkx.lanl.gov)
> or the built-in drawing tools.
>
> e.g.
>
> >>> from networkx import *
> >>> no_nodes=1000
> >>> for p in [ 0.1, 0.2, 0.3]:
> >>> g = watts_strogatz_graph(no_nodes, 4, p)
> >>> print density(g), average_clustering(g)

>
> be warned that drawing large random graphs are not overly insightful
>
> check the examples


 
Reply With Quote
 
bearophileHUGS@lycos.com
Guest
Posts: n/a
 
      10-06-2006
:
> Is there any documentation avaialbe for networkx ? I want to have an
> implementation of random graphs including watts and strogatz graph.


Try reading the code, often it's simple enough.

Bye,
bearophile

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
java graph theory student Java 3 03-12-2006 05:24 PM
perl graph theory (using Graph::Directed) IRR Perl Misc 2 07-27-2004 03:08 AM
New book on Information Theory and State-of-the-art Coding Theory David MacKay VOIP 0 11-05-2003 10:42 PM
GD::Graph: "mixed" graph doesn't recognize "area" graph type Emilio Mayorga Perl Misc 6 10-08-2003 02:14 AM
JGraphT - a free Java library of graph-theory objects and algorithms Barak Java 0 08-07-2003 10:07 AM



Advertisments