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)

9
votes
1answer
115 views

FindHamiltonianCycle is not invariant to edge permutation

Found this bug-like behaviour today: if the order of edges is changed so that VertexList does not return the vertices in canonical order, ...
9
votes
1answer
602 views

How can I display a multigraph with different colored edges?

I'm new to Mathematica(version 9) and I'm trying to display a multigraph with different colored edges. Here's my code so far: ...
9
votes
1answer
135 views

How to get control over DepthFirstScan?

Is there a way to conditionally take control the flow during a depth-first scan against a TreeGraph? I have a tree graph whose nodes are constructed as object, and there's a method ...
9
votes
1answer
280 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 ...
8
votes
3answers
573 views

How can one draw a network with nodes and links in a grid shape?

I'd like to be able to use MMa's graphics to make something like this which I know must absolutely be possible (and probably easy) with MMa. I don't actually even need different colors (though ...
8
votes
2answers
1k views

Dynamic graph visualisation using JLink/Java and GraphStream

Visualising the addition of new nodes and edges to a graph to 'watch it grow' is to something Mathematica is not suited to by default. However this type of animation really helps convey the emergence ...
8
votes
3answers
306 views

Pairwise distances of points and classification using GraphDistanceMatrix

The challenge Given $n$ points in $\mathbf{R}^3$ and a cutoff distance, $d$, I would like to determine all pairs of points that are separated by less than the given cutoff distance, $d$, and all ...
8
votes
4answers
339 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 ...
8
votes
2answers
295 views

Organise a graph's vertices into levels

I would like to organise a graph's vertices in levels. Consider ...
8
votes
2answers
380 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 ...
8
votes
2answers
308 views

Is there a bug in FindClique?

If h is a graph, FindClique[g, {n}] should return a clique on exactly $n$ vertices if one exists in ...
8
votes
2answers
402 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 ...
8
votes
3answers
457 views

Mathematica 10 Graph issue

fixed in 10.0.2 Please try to evaluate this code in Mathematica 10. ...
8
votes
2answers
356 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? ...
8
votes
2answers
277 views

Cases[data,Colon[key,_]] vs. Cases[data,key:_] toward XPath, XQuery

Exploring methods to index and search tree-structured key:value pairs via named-entity index (key paths) as opposed to Position-based indexing. Using Rule as ...
8
votes
2answers
3k views

How to find the Shortest Path, visiting ALL vertices, without coming back to the start (Hamiltonian Path, minimum distance)

A car has to pick up each person and take them to their destination. I am trying to find the shortest tour that will do this. How can I find the shortest path between any s and t.... visiting all ...
8
votes
4answers
3k 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}, ...
8
votes
2answers
258 views

Creating a hyperlink graph from Wikipedia

This goes out to all the Mathematica experts - I'm hoping to get some helpful comments, ideas or code for that matter. In my attempts to maximize learning efficiency I had the idea to create an ...
8
votes
3answers
287 views

Preserving labels when using graph functions

I am finding that some functions that accept a graph and return a transformed graph lose all the vertex and edge labels of the graph being transformed. For example, when I define a graph like this: ...
8
votes
1answer
174 views

Using GraphHighlight interactively

I want to build a small GUI, where the user can select either a single edge or a single node of a graph. I got to this point: ...
8
votes
1answer
299 views

How can I sequentially apply different graph embeddings?

Imagine I have some graph G, and I perform a graph embedding using a command like: ...
8
votes
3answers
456 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: ...
8
votes
2answers
543 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: ...
8
votes
1answer
188 views

Vertex merging in graph?

Given a Graph such as the one produced with the following code ...
8
votes
2answers
953 views
8
votes
1answer
826 views

How to add vertex/edge labels to existing graph

If I have already created a graph using Graph. Later, I want to add to the graph some vertex and/or edge labels, how can I do that? Thank you.
8
votes
2answers
179 views

Finding the minimum vertex cut of a graph

Bug present in at least versions 9.0.1, 10.0.2 and 10.1.0 It seems that Mathematica is not correctly finding the smallest set of vertices that will disconnect a graph. Here is an example: ...
8
votes
1answer
522 views

Why does SocialMediaData return such a small FollowerNetwork?

I have hooked up my Twitter account to Mathematica and I have 1468 followers myfollowers = Length[SocialMediaData["Twitter", "Followers"]] 1468 I wondered what ...
8
votes
1answer
189 views

Enforce graph symmetry

I am using ...
8
votes
2answers
329 views

Finding All Chordless Simple Cycles In A Graph

I am doing a research on networks which consists of polygons with different number of sides. I am trying to find all simple cycles in a network which are chordless. As an example, consider the ...
8
votes
0answers
77 views

Graph: PropertyValue changes and Dynamic

I almost never work with Graph in Mathematica but lately I helped someone with it. For this, I tried to make an animation using ...
7
votes
5answers
419 views

Is there a neat way to generate the odd set constraints matrix?

Given a undirected graph $G=(V,E)$, I am trying to generate a related matrix $M$, where columns are indexed by $E(G)$ and rows are indexed by all odd subsets of $V(G)$. I can finish this task using ...
7
votes
2answers
497 views

Convert Graph to Graphics

In Mathematica 9, a graph is returned as an object with head Graph: In[8]:= CompleteGraph[8] // Head Out[8]= Graph ...
7
votes
3answers
2k views

Travelling salesman with start and end points for 30 points

I am doing a route optimisation for delivery vehicles and failing dismally. Please see problem statement below. My current solution uses FindShortestTour, but this does not have defined start and end ...
7
votes
5answers
598 views

Building graph based on the cities connection?

I built a Graph based on the permutations of city's connections from : ...
7
votes
3answers
292 views

Converting Mesh in Density Plots to a Graph

Consider the following line of code: ...
7
votes
3answers
452 views

I can't understand FindShortest Tour

I can't understand the function FindShortestTour because of the result: FindShortestTour[{ {0, 1}, {5, 1}, {2, 1}, {10, 1}}] ...
7
votes
3answers
694 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. ...
7
votes
3answers
377 views

How to remove all dead ends from a undirected graph?

so what I want to do is take an undirected graph, and remove all the "dead ends" (that is, vertices that are attached to only one other vertex), but do it in such a way that it does it until reaches ...
7
votes
2answers
1k 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: ...
7
votes
2answers
712 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..." ...
7
votes
3answers
310 views

Different colors for nodes in tree plot

I have some list of numbers which I am plotting using TreePlot. This is the code: ...
7
votes
3answers
764 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 ...
7
votes
2answers
509 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 ...
7
votes
1answer
151 views

Replacing graph nodes with matrices

I would like to label a graph with matrices. Suppose the graph is simple: And I have an array mats that contains the labels for vertices 1,2,3,4 (these are just random 0-1 matrices; ignore the ...
7
votes
2answers
368 views

Colorize and the Four-Color Theorem

We can write: MorphologicalComponents[image] // Colorize To assign a random set of colors to each component in some image. The example used for reference by ...
7
votes
2answers
538 views

Edge problems in a directed graph

I want to create the following two graphs. So far I tried the following Code ...
7
votes
2answers
808 views

Coloring edges in GraphPlot

I'm a little stuck with graph drawing part of my research — I can't use the Graph function for plotting my graphs, because my graph is a multi-graph. ...
7
votes
4answers
244 views

Automatically convert pairs of directed edges to an undirected edge?

I have a directed graph, which for some pairs of vertices, has a directed edge between them in each direction. I would like to replace such pairs of directed edges between the same vertices but in ...
7
votes
1answer
188 views

Fractal dimension of a large networked molecular system

I am trying to determine the fractal dimension of this complex biomolecule (figure attached). Any clues as to how this can be done. In trying to determine this quantity, I wonder how its ...