

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer

Mathematica has great operations for analyzing graphs but when the graphs are a bit bigger, Gephi seems to be more efficient (at least on my computer) at drawing and analyzing, i.e. visualizing the graph. So my question is:

What is the "best practice" (white papers, web pages or similar) for how to divide the work between Mathematica and Gephi?

Here is an example, I have a graph from an analysis of all offerings and the biggest clients of a midsize telecom operator, if a client has been invoiced for the offering, there is an edge between the client and the offering. The bipartite graph (see has about 540 nodes (clients and offerings) and about 14900 edges.
enter image description here

In the image - Gephi visualization of "Force Atlas" layout - you see that the core offerings gravitate to the middle. Clients (blue nodes) become grouped around some key offerings (name of clients are removed), e.g. in the upper right corner of the graph you have all the multinationals that are buying international calls and data offerings.

Seeing the clients and offerings in this way is useful for reasoning around a number of business questions such as market segmentation, bundling of offerings, solution building and reasoning around strategic options.


I started doing the experiments in Gephi but after learning more about Mathematica, I would like move more of the work (if not all) to this environment.

However, importing the graph to Mathematica using .gml file from Gephi failed for me. The symptom was that the evaluation of the Import function in Mathematica failed to terminate.

The reason for wanting to import to Mathematica is for more control of normalizing data, annotations, analysis, and simulations based on the graph. This cannot be done in Gephi.

Same question posted on the Gephi forum Gephi - MMA

Miscellaneous notes

Gephi (or similar programs) seems to be faster than Mathematica for the visualization.

Key points for using Gephi initially was the ability to handle the large amount of nodes and edged and the layout algorithms. The "tags" that seem to be relevant for finding our more are:

share|improve this question
Gephi is a rather arbitrary choice, there are many more programs out there to work with graphs. I'd be surprised to see a white paper specifically considering Mma and Gephi (maybe unless it comes from the Gephi people) – Szabolcs Jul 1 '12 at 18:20
I have worked with Graphs in MMA with about 60,000 nodes and edges and that worked out just fine, be it a bit slow. – Sjoerd C. de Vries Jul 1 '12 at 23:21
Sounds good, I will experiment with importing the basic graph directly to MMA and not via the .gml file – FredrikD Jul 2 '12 at 7:29
@fredob314 Try to avoid visualizing it in Mathematica, except when you actually need to see that visualization. Drawing graphs can be very very slow, and Mathematica doesn't seem to cache the last layout. – Szabolcs Jul 3 '12 at 19:45
@Szabolcs, indicates that the visualization and visualization experiments should be done in Gephi (or similar programs) – FredrikD Jul 3 '12 at 20:25

If, as you suggest in your Miscellaneous Notes, speed of the visualization is a primary concern, then perhaps there are ways to speed up the drawing in Mathematica. Of course, it's hard to be sure without sample code. Built in Graph objects, for example, generate dynamic objects and, thus, render more slowly than the Graphics objects generated by say GraphPlot. Perhaps you could use Graph for computational purposes and GraphPlot for visualization purposes? Here's an example:

g = RandomGraph[{540, 14900}];
vl = VertexList[g];
el = EdgeList[g];
t = AbsoluteTime[];
g = Graph[vl, el]

AbsoluteTime[] - t

If you place that last command (AbsoluteTime[]-t) in a separate cell and then evaluate all simultaneously, you should get an accurate time - about 3s on my machine. Here's the corresponding GraphPlot timing:

el2 = Rule @@@ el;
t = AbsoluteTime[];

AbsoluteTime[] - t

This second set of commands takes only 1 sec.

As far as the appearance of the graph goes, be sure to have a look at the General Graph Drawing tutorial in the documentation. There are myriad options that generally affect the appearance of a graph and gives you a lot of control. I think that the defaults are generally optimized for graphs of moderate size.

share|improve this answer
Is there an option like Dynamic->False to influence this rendering behaviour of Graph. If not, would it not be a very useful addition? – Yves Klett Jul 5 '12 at 17:23
@yves I agree. Histogram has something like PerformanceGoal -> "Speed" which disables the tooltips – R. M. Jul 5 '12 at 17:47
Good point! If I can generate and work with the graph in my example, the visualization could be done in MMA. Regarding the "missing coding part", there is no coding involved in visualizing the graph, more of thinking about which layout that makes sense given attributes of the bipartite graph. Before I accept the answer (basically - do it in MMA), I will check if it is practical and works from a performance point of view. Also, to share the data, I can scramble the names clients and the offerings and share the graph data through Google docs. – FredrikD Jul 5 '12 at 18:44

Your Answer


