Tagged Questions

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
1answer
758 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 ...
2
votes
1answer
261 views

Speed up iterated manipulations of a graph / table

I am trying to generate a version of Watts' model of cascading shocks to a network following the discussion on p. 20-25 of this article. The basic premise is to use the ...
14
votes
2answers
570 views

How can I speed up the classic GA for graph coloring?

I'm trying to compute the chromatic number of this graph (which is 28): g = Import@"http://www.info.univ-angers.fr/pub/porumbel/graphs/dsjc250.5.col"; My genetic ...
1
vote
1answer
220 views

Problem setting up edge rendering function

I have a graph, and I want my EdgeRenderingFunction to colour the edges based on the vertex they originate from. In this toy example, I'm trying to get the edge ...
7
votes
2answers
403 views

Can I put tooltips in a Graph?

This doesn't work: Is there a way to do this? My real goal is to identify the second links in the graph below, which shows the results of a webcrawl (using this code). I'm open to another ...
1
vote
1answer
179 views

EdgeRenderingFunction and Graph input output structure

I am trying to create an EdgeRenderingFunction but the more information does not help me at all as far as explaining what the ...
2
votes
1answer
263 views

Changing some stuff to Kruskal's Algorithm

I'm trying to modify this algorithm: http://demonstrations.wolfram.com/ConnectingTownsUsingKruskalsAlgorithm/ The thing is that I want to receive a Graph (declared outside, with all its vertex, edges ...
8
votes
1answer
807 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 ...
4
votes
0answers
420 views

Finding a Graph Shortest Path with Custom Graph Distance Function

What is the best way to find a shortest path by using a custom distance function? I'm trying to play a little bit with the concept of using distributions instead of a deterministic weight value for ...
2
votes
1answer
331 views

Isomorphisms for graphs with loops and multiple edges

I am working with graphs with multiple edges and loops, and I want to eliminate all isomorphic graphs from a long list I've generated. The FindGraphIsomorphism ...
5
votes
1answer
498 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
4answers
2k views

How to generate random directed connected graph?

How to generate random directed connected graph? I need to create graph which will pass: ConnectedGraphQ[^]
6
votes
1answer
348 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 ...
4
votes
1answer
767 views

Creating a weighted, directed graph from ordered triples

I have a relatively large set of data that I am trying to turn into a weighted, directed graph. The data concerns the inflow of migrants based on country of origin. I currently have three columns of ...
9
votes
2answers
315 views

Transition between graphs

I want to visually demonstrate the manipulations made to a graph. For instance, I have a graph g where using the command ...
3
votes
2answers
221 views

Showing a forest with root of the trees on the top

I have a Graph object that contains a forest with directed trees. I want to draw the forest such that the root of the trees are on the top and the leaves are on the bottom. If I use the following line ...
6
votes
2answers
2k views

Eigenvalue / Eigenvector Calculation

I'm currently trying to compute the three smallest eigenvectors for a 34 by 34 matrix. While I was expecting this to take some time, Mathematica has been running for the past 3 hours, which seems ...
7
votes
1answer
317 views

How to implement hive plot for graphs in Mathematica?

I'm trying to implement a version of the hive plot advocated in [Kryzywinski, et al., 2012]. There are many examples of such graphs on the author's webpage. It would be good enough for me to have ...
22
votes
2answers
3k views

How to play with Facebook data inside Mathematica?

I saw this post from Wolfram here and I would like to know how to import facebook data into Mathematica.
24
votes
3answers
2k views

How to generate a random tree?

Is it possible to generate a random tree without explicitly constructing a random adjacency matrix that satisfies tree properties? How about a random directed tree? Edit: incredible answer by ...
29
votes
5answers
6k views

Custom arrow shaft

Inspired by Sjoerd C. de Vries' nice answer to this question, and the desire to pimp a Graph I did with Mathematica recently I would like to know if there are ways to customize the arrow's shaft ...
13
votes
1answer
401 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. ...
6
votes
2answers
208 views

How to make each node of a graph a button?

A newbie question this one - MMA help seems to suggest it would be possible to place a button on ( or have a button be ) each node of graph, labelled with the name of said node. I have no idea where ...
3
votes
1answer
409 views

Control over depth-first scan and breadth-first scan

Is there a way to conditionally take control/modify the flow during a depth-first scan or the breadth-first scan ? Say, for example, if a particular node if found, consider it as a leaf-node and ...
4
votes
3answers
598 views

Place graph vertex labels in circles

Consider the following code: ...
5
votes
2answers
376 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 ...
12
votes
1answer
196 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 ...
12
votes
2answers
503 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 ...
16
votes
2answers
677 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
697 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
614 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
185 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
504 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
470 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
579 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
279 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
311 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
218 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
180 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
471 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
172 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 ...
7
votes
4answers
316 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 ...
16
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
466 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
194 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 ...