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)

16
votes
2answers
699 views

How to measure segment length and branch angle

I am trying to measure segment length and branch angle or bifurcation angle between each pair of segments. My image after thinning looks like this: ...
13
votes
1answer
712 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?
10
votes
4answers
632 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 ...
3
votes
1answer
187 views

Labeled and Graph don't mix?

In an attempt to create a legend for a graph drawing, I find that Labeled only works without the position options (except for Center). ...
14
votes
1answer
513 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 ...
11
votes
1answer
475 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: ...
6
votes
1answer
586 views

How to turn a random graph into a matrix

I have constructed a random graph with Mathematica using the RandomGraph command. Now I would like to convert this graph to a matrix, but I don't know how. The ...
9
votes
4answers
286 views

How can I efficiently check if a graph is unit distance?

A unit distance graph is a graph that is embeddable in the plane so that every edge has length 1. ...
3
votes
2answers
313 views

Combinatorica: Girth[] and FindCycle[] disagreement

Warning: run the following code in a fresh Mma session, as some symbols could be shadowed (depending on your Mma version) While trying to answer this question, I fell into the following: ...
4
votes
2answers
221 views

Odd behavior of GridGraph and DirectedEdges

For some reason the option DirectedEdges->True, albeit working internally with grid graph, does not appear in the visualisation for 1D and 2D graphs. It also ...
2
votes
1answer
121 views

Using EdgeList on a once empty Graph crashes the kernel

Note: this is fixed in version 9. Calling EdgeList on a non-empty graph which was previously empty causes the math kernel to crash. For example, ...
12
votes
4answers
1k 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 ...
4
votes
1answer
182 views

Enhancing GraphUtilities' GraphEdit

One thing I use Mathematica for is building molecular graphs. Until now, I've been content with generating an adjacency matrix from SMILES data, and passing that to ...
10
votes
2answers
482 views

Proper way to add vertices to an adjacency matrix

I'm looking for a robust way to add vertices to a graph by modifying its AdjacencyMatrix. Here's what I have so far: ...
5
votes
3answers
175 views

StandardForm on Graph edges

The Graph command displays edge labels in TraditionalForm. I instead want to use ...
12
votes
2answers
1k views

How to convert an image to a graph and get the positions of the edges?

I am trying to convert an image to a graph. My image is already skeletonized and looks pretty much like this: What I need to do is identify all vertices and edges, and in particular get a list of ...
8
votes
4answers
320 views

Can I stop edges in graphs from drawing on top of the vertices?

Consider the following testadj = RandomVariate[BernoulliDistribution[0.15], {50, 50}]; AdjacencyGraph[testadj, VertexSize -> Large] The nodes are almost ...
17
votes
3answers
1k views

Creating diagrams for category theory

Lately I've been doing algebra and I have found myself drawing a bunch of diagrams when I attempt to solve a problem. Most of the diagrams are very simple so I thought, I bet I can do this in ...
16
votes
3answers
470 views

How to get complete Documentation Center graph of guide pages?

On the very last image below you can see a typical path of walking through Documentation Center guide pages. What is the best way to get the graph data and visualize the whole structure of these ...
2
votes
1answer
145 views

GraphEdit making edges straight

When using a GraphEdit to alter a graph, is there a way to make the edges straight from one vertex to another? Thanks Here is my code: ...
1
vote
1answer
198 views

Recovering vertex names from Combinatorica Graph

According to WRI tech support: Combinatorica functionality is not technically deprecated, though it is our hope that future versions of Mathematica will subsume it entirely by incorporating its ...
2
votes
2answers
217 views

Working around behaviour of EdgeRenderingFunction

One can make graphs GraphPlot[{1 -> 2, 2 -> 3, 3 -> 4, 4 -> 5, 5 -> 1, 1 -> 1, 5 -> 5}] and one can generalize the input such that one ...
3
votes
2answers
109 views

Turning evaluation off

I am making a directed graph, but Mathematica keeps trying to evaluate my labels. I know that I can just use " ", but I have a lot of input. Is there a way to turn evaluation off? ...
7
votes
2answers
896 views

Is it possible to export a graph as graphic to Excel?

It is straightforward to export lists to Excel with Export. Can I export a graphic image, too? This does not work: ...
4
votes
1answer
220 views

Counting the size of the minimum cut produced by MinCut of GraphUtilities`

I want to use the MinCut function of the GraphUtilities` package to find minimum cuts for a few graphs. I'm completely new to ...
5
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
3answers
672 views

Graph adjacency matrix with unconnected nodes

I am trying to display a series of 9x9 adjacency matrices which represent directed graphs on a 3x3 grid. The issue I am running up against is this (compounded by that fact that I don't really know how ...
22
votes
1answer
1k views

Is there a way to convert an image into a Graph?

I'm trying to convert an image with several overlapping dots into a Graph. The goal is to be able to derive the Kirchhoff matrix for the randomly created "network ...
2
votes
2answers
154 views

Is it possible to use PropertyValue to modify properties of Graph objects in a list?

This post can be seen as a follow up to Property assignment on a graph vertex using PropertyValue does not work inside a function. I have defined a function: ...
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 ...
2
votes
0answers
208 views

How to predict some constant number of values with NeuralNetworks

Example: << NeuralNetworks` data = {Sin[#]} & /@ Range[0, 4 Pi, 0.5]; learn = data[[1 ;; 15]]; Now, lets fit our neural network: ...
14
votes
2answers
1k views

Creating a graph with variable size of vertices and variable thickness of edges

I'm trying to create a graph to represent transitions between different states of a system. I would like to represent the time the systems spent in a state with the size of the vertex and the ...
20
votes
1answer
909 views

Graph vs GraphPlot

What is the difference (in purpose) between Graph and GraphPlot? Which function is bested suited to which tasks? Background: I ...
7
votes
2answers
621 views

Controlling TreePlot (and GraphPlot) layout issue

A continuing battle with Mathematica involves graphics heavy with text labels. For example, the following expression renders so that the "Lifecycle properties..." ...
6
votes
2answers
252 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 ...
10
votes
1answer
186 views

Issue with PathGraph

I am having a strange issue with PathGraph. Executing PathGraph[{a, b, c}] or ...
6
votes
1answer
146 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, ...
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 ...
10
votes
2answers
471 views

Select a directed SubGraph without sinks and sources

Consider the following problem: Assume you have a large list of directed edges, that constitute a large graph. I would like to provide an initial subset of vertices and I need to know which additional ...
11
votes
1answer
338 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 ...
5
votes
3answers
320 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: ...
8
votes
2answers
331 views

How do I convert this Nicomachus's Triangle to one with edges?

I want to put edges on this Nicomachus's Triangle r = 7; t = Table[2^(n - k) 3^k, {n, 0, r}, {k, 0, n}]; ColumnForm[t, Center] Is there an easy way to do this? ...
10
votes
2answers
299 views

Using Gather to rearrange my data

I have a list of elements: {{1, 2}, {1, 5}, {2, 6}, {3, 7}, {4, 8}, {5, 6}, {5, 9}, {9, 13}, {10,11}, {11, 12}, {11, 15}, {15, 16}} I have to divide it into ...
6
votes
2answers
308 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 ...
6
votes
1answer
149 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 ...
14
votes
3answers
522 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 ...
7
votes
2answers
486 views

HighlightGraph with different styles

I want to highlight two different directed paths on a graph with two different style. I am using the following two code snippets: ...
4
votes
1answer
284 views

Removing edge weights from a Graph

How can I remove EdgeWeights from a Graph without affecting any other properties of the graph? Let's construct a graph with ...
6
votes
3answers
700 views

Random Geometric Graphs

I'm trying to implement an application which uses random geometric graphs in Mathematica, but it seems Mathematica lacks the functionality. I need the following functionalities: Generate a set of ...