Questions about handling graphs in Mathematica, graph theory, graph visualization, GraphPlot, the built-in Graph type and the Combinatorica` package.

learn more… | top users | synonyms (2)

15
votes
1answer
325 views

GeoGraphics : path within a country

I am using GeoGraphics to visualize electricity distribution networks in certain countries. I have susbtation location data, as well as network incidence matrices (...
15
votes
1answer
458 views

Need tips on improving this directed graph

First we define a function that returns the least odd prime factor. lopf[n_] := FactorInteger[n][[2, 1]] Then we craft a routine that performs the 3x+1 steps ...
15
votes
1answer
1k views

Use Mathematica to do a network analysis of Mathematica.SE

Recently Wolfram|Alpha announced that you could use it to analyze your Facebook site. How could I do a network analysis of questioners and answers here on Mathematica.SE?
14
votes
2answers
304 views

Zoom in on a 2D graph

I have seen many queries on zooming in on plots etc. But I haven't seen any regarding 2D graphs. For eg if I have a graph like Graph[{1->2, 2->3, 3->1}]. ...
14
votes
3answers
607 views

Determining all possible traversals of a tree

I have a list: B={423, {{53, {39, 65, 423}}, {66, {67, 81, 423}}, {424, {25, 40, 423}}}}; This list can be visualized as a tree using ...
14
votes
3answers
781 views

Vizualization of percolation paths

I did a simple demonstration to illustrate the percolation theory for my students. The content is a conductive square network possessing electrodes at its top and bottom edges. Some randomly chosen ...
14
votes
4answers
2k views

Finding elementary cycles of (directed) graphs

I need to enumerate all the simple cycles (i.e. elementary cycles where no vertex is repeated other than the starting) of a graph which has both directed and undirected edges, where we can treat the ...
14
votes
6answers
955 views

Finding all paths of certain length between vertices in path graph, non-simple ones too

First I will tell you what my ultimate goal is, because maybe there's another way of doing it other than what I am trying. I need a list of all $(a_1, a_2, \ldots, a_N)$ tuples that satisfy certain ...
14
votes
1answer
585 views

Dual graph of an arbitrary (planar) graph

Every planar graph has a dual. How can I obtain it with Mathematica? I know that GraphData provides the DualGraph property for ...
14
votes
1answer
160 views

IsomorphicGraphQ fails to recognize that two empty graphs are identical

Bug introduced in 9.0.1 or earlier and persisting through 10.4.0 Consider the following two graphs: ...
14
votes
2answers
562 views

How to build a 3D graph from a 3D matrix?

Following this and that question and the corresponding answers, Mathematica can build 2D graph from 2D matrices. Question How to make the corresponding 3D graphs from 3D cubes? Attempt ...
14
votes
2answers
2k views

Simple algorithm to find cycles in edge list

I have the edge list of an undirected graph which consists of disjoint "cycles" only. Example: {{1, 2}, {2, 3}, {3, 4}, {4, 1}, {5, 6}, {6, 7}, {7, 5}} Each ...
14
votes
1answer
810 views

Visiting nodes in a tree bottom up

I have a problem that can be reduced to this one: Suppose I have an unbalanced (almost random) tree. The leaves of the tree have one property already set, and all vertex (including the leaves) have ...
14
votes
2answers
536 views

Listing subgraphs of G isomorphic to SubG

If I have an undirected graph G, how could I write a function in Mathematica to obtain a list of subgraphs of G that are isomorphic to some other undirected graph SubG? I'd like to learn how to ...
14
votes
1answer
523 views

Transform an expression into a graph that can be plotted with TreeGraph (not TreeForm)

I would like to plot an expression (like TreeForm does), but using the new TreeGraph functionality. ...
14
votes
1answer
153 views

Question about TransitiveReductionGraph

Bug introduced in 10.0 and persisting through 10.4 Note: TransitiveReductionGraph is new in 10.0. In Mathematica 10.0 and 10.1, according to the documentation ...
14
votes
1answer
434 views

When to use built-in Graph/GraphPlot vs. Combinatorica

What are the pros and cons of using built-in Graph/GraphPlot (and related) types vs. types in the Combinatorica package?
13
votes
3answers
622 views

Binary decision diagrams (BDD)

I would like to use Mathematica to help me simplify a given Binary Decision Diagram (i.e. pick the optimal variable ordering). I don't seem to find anything at all on the topic, although it is ...
13
votes
1answer
238 views

Layout a second graph of the same nodes in the same way

I have a number of graphs with the same nodes. I would like to be able to somehow save the layout that results from the spring embedded results of one graph (the first image), and have the other ...
13
votes
2answers
353 views

Why is NeighborhoodGraph so slow?

To get neighboring vertices I first tried: gg = GridGraph[{10, 10, 10, 10}]; VertexList[NeighborhoodGraph[gg, 1, 1]] // AbsoluteTiming {5.539308, {1, 2, 11, ...
13
votes
4answers
570 views

How to recompute the layout of a Graph?

I asked a question about changing Graph properties in a similar way to how Show can change ...
12
votes
2answers
799 views

Convert Graph to Graphics

In Mathematica 9, a graph is returned as an object with head Graph: In[1]:= CompleteGraph[8] // Head Out[1]= Graph Right-...
12
votes
2answers
561 views

Calculating morphometric properties

Is it possible to calculate segment length, segment diameter and branch angles for three dimensional geometry. Geometry contains vertex points and polygon surfaces as ...
12
votes
2answers
427 views

Comfortable Edge Labeling of Undirected Graph

I'm working on a program that finds special [called "interval"] edge-colorings for graphs. Output is as follows: ...
12
votes
1answer
266 views

How to generate a Graph from a picture of a graph?

I have a picture like this I can get this graph's vertexes ...
12
votes
3answers
998 views

Remove redundant dependencies from a directed acyclic graph

Given a directed acyclic graph, I want to remove all the edges $v_i \rightarrow v_j$ if $v_j$ is reachable from $v_i$ by some other path. Given the rich set of graph algorithms in Mathematica, what is ...
12
votes
1answer
2k views

How to divide a graph into connected components?

Suppose I have some edges: edges = {1 -> 2, 2 -> 3, 3 -> 1, 4 -> 5, 3 -> 6, 7 -> 8, 8 -> 9, 8 -> 10}; And I make a graph: ...
12
votes
2answers
1k views

Combinatorica package and graph-theoretical issues

I've searched for a solution to my problem a couple of days, and I didn't find one. Hope you guys can help me. I'm currently trying to solve some graph-theoretical problems. One of them is to find ...
12
votes
2answers
422 views

Determining whether two $k$-chromatic graphs are isomorphic (respecting vertex coloration)

Consider the case where I have two $k$-chromatic graphs $G_1$ and $G_2$, i.e. two graphs where individual vertices can be colored with one of a set of $k$ total colors, and I would like to determine ...
12
votes
2answers
240 views

Graph smoothing keeping vertices fixed?

Context Given a Graph like this one: ...
12
votes
1answer
849 views

Drawing Graph Products

I need to draw graphs that are Cartesian products of 2 graphs. I need them to look like this: . So each copy of the factors can have LinearEmbedding, but the whole ...
12
votes
1answer
1k views

How to speed up Minimum Spanning Tree algorithm?

How to speed up MST algorithm? I work with graphs and I have adopted Prim's algorithm for my needs, from here. The graphs which I use are very dense (number of vertexes: $V=500$ and every vertex is ...
12
votes
1answer
580 views

Drawing dessins d'enfants (bipartite graphs subject to certain conditions)

I want to write a function which constructs all possible dessins d'enfants (bipartite graphs fulfilling certain criteria, given below) from a collection of data presented in the following form: $\...
12
votes
0answers
172 views

A question about weighted graphs

Bug introduced in 8.0 or earlier and persisting through 10.3 I need create a weighted graph with given data. Number of nodes: $53$ $\quad$ Number of edges: $91$ ...
11
votes
4answers
489 views

Efficient setting of properties of multiple vertices in Graph

The functions SetProperty and PropertyValue can only set a single property of a single vertex, as far as I know. How do I set a ...
11
votes
4answers
838 views

Ordering vertices in GraphPlot

I'm new here, so forgive me if this question is not well-posed/duplicates an earlier question - although I've searched for similar questions without success. I'm trying to present a plot of ...
11
votes
2answers
927 views

Extracting vertex coordinates from an automatically laid out graph

Given a Graph with an automatically computed layout (i.e. not explicitly given VertexCoordinates, but using a ...
11
votes
2answers
202 views

Is it possible to get the (x, y) position of nodes in a `Graph`?

Given a graph... RandomGraph[{20,40}] ...is it possible to retrieve the (x, y) coordinates at which the nodes are drawn? ...
11
votes
5answers
5k views

How to generate and draw simple bipartite graphs?

A bipartite graph is a graph whose vertices can be divided into two disjoint sets. Given two lists: {1, 2, 3} and {x, y, z}, ...
11
votes
2answers
252 views

Vertex descendants subgraph

Keywords: vertex, ancestors, descendants, subgraph, directed graph, flow subtree So let's say we have a TreeGraph: ...
11
votes
1answer
537 views

Dynamic visualization of Graph[] on a webpage

How can we embed a dynamic version of a Graph object on a web page, similar to the one showcased on the networkx home page? This sort of dynamic visualization can ...
11
votes
3answers
564 views

Mathematica 10 Graph issue

Bug introduced in 10.0.0 and fixed in 10.0.2 Please try to evaluate this code in Mathematica 10. ...
11
votes
2answers
125 views

EdgeAdd function not adding edges to a RandomGraph[ ]

Bug introduced in 9.0 or earlier and persisting through 10.3.1 I have a graph: g = RandomGraph[{1, 0}] So basically, it is just one vertex. I want to add some ...
11
votes
1answer
160 views

Left Right Straight Maze

How do I generate a Left, Right and Straight ordering for a maze for something like the following? Similar to generating a left and right ordering for someone walking in real life. ...
11
votes
1answer
457 views

Ulam's Spiral with Opperman's diagonals (quarter-squares)

First we craft a function to return the quadrant boundary based on Oppermann's Conjecture a[n_] := (Mod[n, 2] + n^2 + 2 n)/4 Then we create a few lists ...
11
votes
1answer
139 views

How can I route edges manually for a Graph?

Most graph layouts supported by Mathematica use straight lines for edges; or at least something that only depends on the coordinates of the two adjacent vertices of the edge and nothing else. A ...
11
votes
2answers
121 views

Why are some of the isomorphisms not bijective?

Bug introduced in 10.4 Mathematica computes all the isomorphisms between graph g1 and g2: ...
11
votes
2answers
608 views

Dynamic graphics are less responsive inside a Manipulate

I have some code which displays a GraphPlot and allows the user to click on any vertex in the graph to display some information about that vertex in a popup window. ...
11
votes
2answers
244 views

Finding the minimum vertex cut of a graph

Bug introduced in 9.0.1 or earlier and fixed in 10.2.0 Note: FindVertexCut is new in 9.0. It seems that Mathematica is not correctly finding the smallest set of ...
11
votes
2answers
2k views

Mathematica Package for Bayesian Networks

Are there any packages that allow the simulation of Bayesian Networks with Mathematica? I found what seemed to be a promising package (Dynamics) on a Brown University URL, http://www.cs.brown.edu/...