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)

2
votes
2answers
251 views

Manipulate graphs in 3D

Is it possible to Manipulate Graphs (e.g. a ...
19
votes
5answers
986 views

How can I replace bi-directional DirectedEdge pairs in a Graph with a single UndirectedEdge?

The Cayley graphs produced by Mathematica 8.0's CayleyGraph function represent actions that are their own inverses in an unconventional way: rather than using a ...
11
votes
4answers
11k views

Finding all simple paths between two vertices in a graph

There are built-in methods to find a shortest path between two vertices in a graph, and the question on finding all shortest paths between two vertices has gathered quite a bit of attention. A path ...
2
votes
3answers
270 views

How to draw a combinatorial graph with different colors of edges?

For example, like above. I've read some examples and descriptions in here, but couldn't figured it out.
3
votes
1answer
49 views

Make AdjacencyGraph hide single unconnected elements

Is there a way to force AdjacencyGraph to hide single unconnected or self connected elements? ...
9
votes
1answer
236 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 ...
5
votes
3answers
181 views

Converting expressions to “edges” for use in TreePlot, Graph

This question is similar to this: Nested list to graph. How to "flatten" an arbitrary expression, eg expr = a[b[c, d[e][f], g], h] to a list of key-value pairs ...
0
votes
1answer
178 views

Creating a Network from a Output

So I used the locator pane to derive the positions of a vertex on a picture. The picture was the Maryland Power Grid and the vertices were the generators and loads of the power system. When I clicked ...
1
vote
2answers
88 views

How can I speed up the export of graphs in DIMACS format?

I'm creating random graphs with suitable properties and exporting them in the DIMACS format. Already, for rather small graphs with, say, ~60k vertices and ~240k edges, ...
14
votes
4answers
492 views

Can TreeForm be displayed “sideways”?

One recurrent problem I'm having with displays generated with TreeForm is that the expressions to be so displayed often at least one level with many (> 20) nodes ...
30
votes
8answers
2k views

Longest path in 0/1 matrix

I have a matrix of 0's and 1's forming a number of disjoint paths:   I would like to find the lengths of the paths, and from that "spectrum," the longest length (in the above example: 27, ...
4
votes
2answers
112 views

How to obtain all the distinct De Bruijn sequences?

In combinatorial mathematics, a $k$-ary De Bruijn sequence $B(k, n)$ of order $n$ is a cyclic sequence of a given alphabet $A$ with size $k$ for which every possible subsequence of length $n$ in $A$ ...
6
votes
2answers
136 views

Why the Mouse dragging response not as smooth as Locator

I am experimenting to use MouseDragged eventhandler to change the vertices positions of a triangle, it works, but not as smooth as using Locators. Is this the ...
6
votes
3answers
268 views

Nested list to graph

The following nested list can be regarded as a representation of a (tree) graph: ...
4
votes
1answer
113 views

The algorithm of ListGraphs[n,m]

I'm not sure if this is a Mathematica problem, math problem or a CS problem, so if this is off-topic please transfer it. In the package Combinatorica there is a ...
3
votes
2answers
120 views

Vertex Names of Subgraph in Order of Connectivity

I extract path subgraphs $P_4$ of an undirected graph $G$. And want to list the VertexNames of the subgraphs in the same order as they are connected. Here is an example: ...
0
votes
0answers
33 views

Find set of subgraphs of g1 isomorphic to g2 [duplicate]

I would like to find all the subgraphs of a given graph g that are isomorphic to the graph h. My current code doesn't work how it should. Many solutions are missed and I think something is ...
2
votes
3answers
160 views

Sequence of binary trees with different source nodes and with the same Strahler hierarchical order

I would like to create a picture which contains a sequence of binary trees with the same Strahler hierarchical order (for example equal to 2) e with a sequence of different source nodes "i" (from 1 to ...
0
votes
0answers
52 views

how to rewire the minimum number of edges in a disconnected bipartite graph, so to transform it in a connected one

Consider an incidence matrix A for a bipartite graph (Aij=1 if node i of group 1 and node j of group 2 are connected). A is not symmetric. Assume that A is disconnected or only weakly connected, i.e. ...
7
votes
4answers
2k 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}, ...
1
vote
1answer
85 views

Rendering of a HighlightGraph in a Manipulate content pane distorted by changing the highlighted edge

A HighlightGraph inside a Manipulate initially displays correct however after approximately 2 seconds, the layout changes and ...
3
votes
2answers
117 views

Labeling vertices by number in Graph: Getting text to display at the right size

Minor aesthetic question here. I was playing around with Graph's and decided to render a cute-looking family of directed graphs, with the vertices being the number ...
3
votes
0answers
171 views

Understanding performance: graph connected components

I need to analyze directed graphs with 10M edges, 1M vertices, and 300K strongly connected components, so that the largest one contains 400K vertices. I read some explanations of Leonid Shifrin here, ...
1
vote
2answers
75 views

Using Combinatorica`ListNecklaces in v9

I am using Mathematica for visualization of DeBruijn graphs. However, I am having a bit of trouble using ListNecklaces. I want to know how many cyclic shifts of ...
2
votes
1answer
129 views

distance between each vertex of a graph and its output

I have a question regarding this Q&A. Let's call a vertex that is not the tail of any directed edge an output of the graph. The graph below has only one output (at the far right). If I want the ...
17
votes
5answers
565 views

Graph from binary matrix (not adjacency) respecting the original matrix positions

I have a binary matrix. My objective is to connect every close (without "jump") elements with value equal to 1, but I must keep the point positions, just like it's shown at the image. Can somebody ...
0
votes
0answers
72 views

Centrality measures and normalisation

Are centrality measures normalised in Mathematica 9? Only ClosenessCentrality is normalised. How I can normalise other centrality measures notably ...
8
votes
2answers
336 views

Graphing a network with state transition flows (of varying size)

In one of Stephen Wolfram's recent blog posts (http://blog.stephenwolfram.com/2013/04/data-science-of-the-facebook-world/#more-5350) he provides the network plot below. The size of the arrows that ...
1
vote
0answers
177 views

Triangular lattice with periodic boundary conditions

I am trying to generate an equilateral triangular lattice with fixed vertices and periodic boundary conditions. I am supposed to assign an index (starting from 0) to each vertex in my lattice and then ...
1
vote
2answers
159 views

Error changing edge thickness in a GraphPlot

I'm having some problems with the Mathematica graphics inspector. I want to make a graph with the following code: ...
8
votes
3answers
430 views

TreePlot with centered vertexes

I want to draw a tree plot for Euler totient function for this question like the following: I generate the EulerPhi for first 20 numbers into a list: ...
3
votes
1answer
177 views

find cycle in directed graph

Given a digraph G in the form of a list of edges, is there implemented some command that returns a directed cycle in G of ...
0
votes
2answers
234 views

Generating a random tree of given cardinality, depth, and labeling

For demo, exploration and teaching purposes, I would like to be able (and asking you for help) to generate these special instances of trees: For given: N - number of nodes in the tree D - depth of ...
0
votes
1answer
64 views

How do I get a different (random) independent edge set each time I run FindIndependentEdgeSet?

I'd like to use FindIndependentEdgeSet[g] repeatedly to get random maximal matchings of a fixed graph, but each time I call this function it gives me the same answer (i.e. the same list of edges). ...
-1
votes
1answer
62 views

How to draw a network from a dataset reporting the labels of nodes of every link?

I have a dataset in format .txt of a directed network, containing a matrix A of dimension ...
1
vote
1answer
56 views

VertexSize with GraphPlot [closed]

I'm constructing a graph using GraphPlot and I want some vertices to have a different size than others, like this: ...
1
vote
1answer
63 views

Get subgraphs: communities of graph g

I have a graph g. I want a set of graphs c which holds the community subgraphs of g. I ...
4
votes
0answers
170 views

How to draw hypercube graphs

I'd like to draw hypercube projections like those on the Wikipedia page: I tried with HypercubeGraph[6] but the graph does not look right; it is not ...
6
votes
3answers
332 views

Export Graph to PDF

I know that I exported Graphs to PDFs before but it doesn't seem to work any more. I tried K5 = GraphData[{"Complete", 5}] Export["K5.PDF", K5] And I get a PDF ...
3
votes
1answer
136 views

How to get a list of 3-connected graphs?

I'd like to use GraphData to get a list of graphs with vertex connectivity at least 3. I know GraphData["Nonplanar", 6] gives ...
6
votes
1answer
236 views

How to view all graphs available in GraphData?

Is there a "gallery" view of all the graphs available in GraphData? I realize that some graphs may not lend themselves to such representation (e.g. some may have ...
5
votes
1answer
158 views

Why do vertex labels disappear when I edit with drawing tools?

I'm trying to change the text and arrow style in GraphPlot using the drawing tool, but the the vertex labels disappear when I do that: ...
10
votes
2answers
504 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. ...
3
votes
1answer
190 views

Bring Vertices to the foreground

I'm having some issues with being able to trigger the Tooltip in an AdjacencyGraph, as the edges are "covering" the vertex labels. In the example provided, there are no issues to display the tooltip ...
7
votes
3answers
574 views

Visualizing the output of a Voronoi diagram computation

I need to plot a graph (to be specific: Fortune Algorithm output) with given vertex coordinates and a few unconnected vertices. I am thinking of using Mathematica for that. ...