Re: Graph Theory

2006-10-05 Thread boggom

[EMAIL PROTECTED] 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

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Graph Theory

2006-10-06 Thread boggom
Other than reading the reference on the
website
https://networkx.lanl.gov/reference/networkx/

you can read the code (eg by browsing the
svn by pointing your web browser at
https://networkx.lanl.gov/browser/networkx/trunk

and then look at
networkx -> generators -> random_graphs.py)

If you are not in interactive python mode, try
pydoc networkx.watts_strogatz_graph

A great way to explore a python package is to
 use ipython in interactive mode, then you merely
need to type

>>> from networkx import *
>>> watts_strogatz_graph?

and you will get the documentation.



[EMAIL PROTECTED] wrote:
> Is there any documentation avaialbe for networkx ? I want to have an
> implementation of random graphs including watts and strogatz graph.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What makes an iterator an iterator?

2007-04-18 Thread boggom

> I find myself perplexed as to this behaviour.

You can not iterate over a dead object!

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: very large graph

2008-06-26 Thread boggom
Drawing a large graph like this is not
very insightful by itself, and doing this well
is still an art form.
Many cool visualizations, and all
very domain and question dependent,
can be found at
http://www.visualcomplexity.com/vc/

You can also search on flickr for network
and graph drawing.

Much of it is eyecandy though. What do you
really want to know?

Your graph is not overly huge for python, provided
you do not want to compute nonlocal statistics
such as betweenness metrics. (If you have
a laptop running windows and with
less than 1GB RAM, then you have a really large graph.)

Given that you do not know much about graph theory,
I would suggest that networkx applied to a
subset of your large website --- one of the
representative branches --- will allow
for the fastest way to figure out what you
want to do. Python provides access to many other
libraries for html mangling or even webpage
analysis. Imagine writing C code to ask questions
like: how many pdfs and images? how big are they?
when were these pages last updated? etc.
You can come up with 10 questions faster
than you can write C code, and this where
python has its great advantage.

You can learn graph theory while using these libraries,
on one of the smaller branches of your website tree.
Even interactively by using ipython.
This provides at least a feeling of great power while
stumbling in the dark.

Many of your edges are probably repetitions
associated with navigation menus to provide
a standard look-and-feel. See how much of that
you can strip out and find the cross-links that took
effort to insert an manage. (I suggest
doing the analyis on a digraph rather than a graph,
even if you want to draw it as graph.)


For visualization, the new ubigraph is quite
fast compared to graphviz.
See the cool networkx + ubigraph
video at http://ubietylab.net/blog/


Ask on the networkx mailinglist when stuck.

--
http://mail.python.org/mailman/listinfo/python-list