Any function in that Graphviz which can do that? If not, any other free software that can do that?
not that I nvr thought of this, it is just that sometimes the complement is very difficult to compute, esp if u hv many nodes and edges in the original graph
yeeen
2010-01-15 01:22:15
so the follow up qn is whether there is any software or online tools that can accomplish it
yeeen
2010-01-15 09:27:11
Well, graphviz is a good one for plotting. How many nodes and vertices do you have? What is the input format?
Hamish Grubijan
2010-01-15 15:03:11
I want an efficient sw, so u can assume quite a lot of vertices and edges in the complement graph. Input is to manually type in...
yeeen
2010-01-17 00:48:01
+2
A:
Given that you want to render your graphs in graphviz, i suggest using the python library, networkx, to calculate graph complement. Networkx is an excellent library for graph theoretic analysis; it also has a seamless interface with graphviz.
(Rough definition of a graph complement: imagine a graph A', which has the identical nodes as A but that has all possible edges, i.e., every node is connected to every other node; now remove from A' the edges in A; what's left is the complement of A, A')
import networkx as NX
G = NX.gnm_random_graph(10, 10) # create a random graph w/ 10 nodes, 10 edges
G_cmpl = NX.complement(G) # get the complement of graph 'G'
# to render it in graphviz:
NX.write_dot(G_cmpl, "somefilename.dot")
doug
2010-01-15 17:42:21
This looks like what I want. But how do i install networkx using the downloaded Python Egg file? The quick download in the install.txt only says "Get NetworkX from the Python Package Index at http://pypi.python.org/pypi/networkxor install it with:: easy_install networkx and an attempt will be made to find and install an appropriate versionthat matches your operating system and Python version." I have installed Python btw.
yeeen
2010-01-17 00:51:11
You need to install 'setuptools' in order to be able to install packages via 'eggs.' I don't know your OS, so here's the link to a step-by-step guide: http://peak.telecommunity.com/DevCenter/EasyInstall. if you don't want to install using setuptools ('eggs'), go to the Networkx repository (http://networkx.lanl.gov/download/networkx/) dll and unpack the latest version appropriate for your OS, open a shell, cd into the package's top-level directory and type at the shell prompt: 'sudo python setup.py install' (without the quotes). That will install it.
doug
2010-01-17 02:49:15