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)

6
votes
3answers
274 views

Enumerate the 1-factors (perfect matchings) of $K_n$

Introduction I would like to enumerate the 1-factors, or (near-)perfect matchings, of the complete graph Kn. The adjacency list representation for Kn is basically { (x, y) | 1 ≤ x < y ≤ n }. For ...
6
votes
1answer
251 views

Generating a (random) 2-dimensional cellular network

I want to generate a network of random cells like the following picture: The general idea is to generate some random points (x,y) as coordinate of a vertex and then randomly choose some of these ...
6
votes
1answer
890 views

All possible topological orderings of a graph

TopologicalSort[] returns one of many unique orderings. From wikipedia: if a topological sort does not form a Hamiltonian path, the DAG will have two or ...
6
votes
3answers
409 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 ...
6
votes
1answer
1k views

Analysis of Facebook group

I am the admin of a Facebook group for our year at university and wanted to graph the members of the group like you can with your own friends so we can find the isolated people and get rid of them (as ...
6
votes
2answers
336 views

Flow/graph-based programming in Mathematica?

Is it possible in Mathematica to write a program inside a graph? For example if you have a bunch of different If[] statements that you need to embed within one ...
6
votes
1answer
1k views

When do I use Mathematica, when do I use Gephi, and how do I use them together?

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 ...
6
votes
2answers
261 views

Visualize the output of Trace in a tree structure

The output of Trace[expr] can be nicely represented as a tree, I guess. Here is an example trace. ...
6
votes
1answer
76 views

Graph: Coloring Edges individually

CODE: Graph[{Style[0 -> 1, Red], Style[0 -> 1, {Blue, Dashed}]}] This mathematica code will make both lines solid Red, since they belong to the same two ...
6
votes
1answer
245 views

Shortest polygonal path

I'd like to find the shortest distance between some points (every point must be visited), such as between these 3 points: ...
6
votes
1answer
138 views

Tooltip not working in web deployed cdf

I deployed a CDF file in a web page. I used both Mouseover and Tooltip functions. They both work in the raw CDF file. The ...
6
votes
1answer
602 views

(Efficiently) Generating graphs with vertex degree 3 for all vertices

I'm working on a graph theory problem, and given $n$ vertices, I would like to be able to generate all non-isomorphic connected graphs (not necessarily simple) with $n$ vertices, each having degree 3. ...
6
votes
2answers
322 views

How do I reorder vertices in a graph?

I have a directed acyclic graph $g$, and I'd like to re-order the vertices in this graph object such that when I call VertexList[myGraph] the vertices appear in ...
6
votes
1answer
189 views

Property assignment on a graph vertex using PropertyValue does not work inside a function

I created this function: AddStone[board_Graph, v_, s : white | black | empty] := PropertyValue[{board, v}, VertexState] = s This function should change the ...
6
votes
1answer
973 views

Ordering vertices with minimum Edge Crossing in Circular Graphs

Weighted and sorted Mathematica circular graphs are shown below. My question is how to reorder the vertices in such a way that they have minimum cuts (intersection of edges) while keeping the circular ...
6
votes
1answer
153 views

Vertices, their labels, and how to refer to them?

In the examples I have seen, graph vertices in Mathematica are usually explicit small integers. However, Wolfram documentation says that vertices can be any arbitrary expression (eg., george, x^2, ...
6
votes
1answer
329 views

Connect neighbouring points as list of segments in 2 D

Context I am interested in connecting neighboring points in 2/3D as list of segments. I am guessing this is something within the reach of graph theory, which is well implemented in mathematica. ...
6
votes
1answer
165 views

Graph rendering not working as expected

I'm running the older Mathematica v6 which seems to go through the edges of graphs twice. Is this a bug? Is it fixed on the latest version? Please just try this command: ...
6
votes
1answer
2k views

Is it possible to generate a Hasse Diagram for a defined relation?

I'm looking for a way to create a Hasse Diagram from a given partial order binary relation. The relation will be given explicitly, for example: ...
6
votes
1answer
427 views

Interactive Graph Editing with Animation

I want to make a simple interactive user interface like this: Such that when the user clicks on the "Add Edge" button, the edge specified by from and to fiels is added to the graph. The new graph ...
6
votes
0answers
61 views

Functionality of FindMaximumFlow

I know that the superseeded function NetworkFlow (needs Combinatorica) uses Goldberg-Tarjan's Push-Relabel-Algorithm but i cant find any information on Mathematica's built-in-function (...
6
votes
0answers
51 views

VertexDelete not working on graph with VertexWeight

Bug introduced in 10.0 and persisting through 10.2.0 Good afternoon, I have observed an "unexpected behaviour" with VertexDelete and a graph with vertex weights. This is a minimal working example: ...
6
votes
0answers
103 views

HighlightGraph and Hyperlink

In the documentation of Mathematica it is mentioned that you can use Hyperlink and Tooltip as wrapper in a similar manner as ...
5
votes
3answers
728 views

Graph and Markov Chain

I have the following code: proc = DiscreteMarkovProcess[1, {{0.6, 0.4}, {0.3, 0.7}}] Graph[{"A", "E"}, proc, GraphStyle -> "DiagramBlue"] How can I 'force' ...
5
votes
3answers
829 views

How to create a planar graph from a set of random points

Question Given a set of points in the plane, how can you create a planar graph in the standard graph representation of Mathematica (version 9 or higher), from these points? Background A planar ...
5
votes
3answers
256 views

Enumerating all connected graphs with 9 vertices

The version of my Mathematica is 10. I generate a connected graph with 9 vertices, but find that it is not included in Mathematica. ...
5
votes
3answers
568 views

How to display edge labels above edges?

The following code shows that edge labels "cover" edges in GraphPlot3D ...
5
votes
2answers
189 views

Drawing a path which realises the diameter of the graph

So I enter a (0,1) adjacency matrix and I get the following graph: The diameter of this graph is 4. How can I ask that two vertices which realise this diameter be drawn with different filling ...
5
votes
4answers
118 views

Vertex styling in CommunityGraphPlot

Is there a way to change the colours of nodes within one community? Mathematica assigns vertex colours automatically to each community. However, I'd rather like to use my own colour set. ...
5
votes
2answers
187 views

Graph expansion on Mathematica

Is there a way by which Mathematica can be given a graph as an input and be asked to find its expansion? Note: By "expansion" I mean the quantity called "isoperimetric number" or "Cheeger constant", ...
5
votes
3answers
187 views

StandardForm on Graph edges

The Graph command displays edge labels in TraditionalForm. I instead want to use ...
5
votes
1answer
278 views

Is it possible to draw a curved edge between two vertexes of a graph? [duplicate]

The following code generates a graph. ...
5
votes
3answers
768 views

Graph generation given number of edges and nodes

I was wondering if it is possible to have Mathematica generate all graphs with a given number of edges and nodes (and possibly restricting the adjacencies) and draw them I know that there are some ...
5
votes
3answers
394 views

Rendering polygon as graph with directed edges in Mathematica

In Mathematica I'm trying to render a polygon as a set of vertices and directed edges. What I have so far: ...
5
votes
2answers
180 views

Improving performance in the generation of random (directed acyclic) graphs

I need to generate large (directed, acyclic, transitive) graphs. My code in Mathematica gets very slow for large numbers of vertices. I've tried a number of approaches and I can't find any significant ...
5
votes
3answers
362 views

Centrality measures for single nodes

I am producing a graph, generated by a list of adjacent nodes. (The list looks like {1 ->583, 1->2977, 2->14, 4->1293, 5->221, ...}. Each node of my ...
5
votes
2answers
74 views

How to show the direction of highlighted path in graph

I am trying to show the direction of FindHamiltonianPath on the Graph. ...
5
votes
1answer
84 views

How to create a MorphologicalGraph from MorphologicalBranchPoints

I want to select the morphological branch points of a thinned image to create a MorphologicalGraph like the one obtained by Pruning. I want to avoid the pruning step. How can I delete from the ...
5
votes
3answers
103 views

GraphIntersection Problem

I Have a problem when plotting 2 functions. I want to find out where the two graphs intersect eachother. That said, I want the coordinates (x, y) of the point. ...
5
votes
1answer
174 views

How to impose control over vertex-to-vertex Graph edges?

I’m working on a Markov Chain and hope there is a way to impose control over how Mathematica places edges to connect vertices in a Graph. My Markov Chain currently consists of 4 vertices with 2 of the ...
5
votes
2answers
167 views

BezierCurve in EdgeShapeFunction fails when used on multiedges graph

I would like to create a network graph with curved edges. To do this, I wrote this function: ...
5
votes
2answers
286 views

Is there something akin to “SubgraphIsomorphismQ” in Mathematica 9?

Provided two unlabeled graphs, $G$ and $H$, I would like to test where $H$ is a subgraph of $G$. In other words, I'd like to test whether we can prune some fixed number of vertices or edges from $G$ ...
5
votes
1answer
194 views

Keeping vertexcoordinates after adding a new vertex

I want to add a new vertex to a graph, with fixed VertexCoordinates but when I use VertexAdd, the new graph does not have the VertexCoordinates of the previous one. ...
5
votes
2answers
253 views

Is there something wrong with VertexConnectivity

Note: this is fixed in version 10. As I noticed in the documentation VertexConnectivity is defined as the following The vertex connectivity of a graph $g$ is ...
5
votes
2answers
442 views

Merging (combining) tables of graph relationships (2-mode to 1-mode network)

I have some data of corporate board members in Australia in excel format here (Dropbox public link). It is the data behind this graph. The first worksheet is of all the vertexes (directors and ...
5
votes
2answers
238 views

How can I preserve the properties of edges of the original graph $g$ in a subgraph that doesn't include every edge of $g$?

The closest question to the following I could find was Preserving labels when using graph functions, but it doesn't seem to cover this. Consider a graph g where ...
5
votes
1answer
178 views

Calculate dual graph of planar Graphics map

This diagram from a Wikipedia article illustrates what I hope to accomplish in Mathematica: I have a planar map in Graphics format. Here are two very simple ...
5
votes
2answers
150 views

Test existence of a path from one side of a graph to another

I'm trying to determine how I can test if a path exists from one side of a graph to another as efficiently as possible. If I have the Lines given by: ...
5
votes
3answers
862 views

Fast code to generate large random graph with fixed degree sequence

I'm trying to create a function so to generate large random graph with a fixed degree sequence $\{v_1,v_2,\dots,v_N\}$, where $N$ is the number of vertices in the graph. The Mathematica function that ...
5
votes
2answers
244 views

Graph does not evaluate some options when not displayed

How can I force Graph to evaluate all its options without actually displaying the graph itself? Evaluating the following code ignores the ...