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)

4
votes
2answers
431 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' ...
28
votes
1answer
932 views

Finding the likeliest path in a Markov process

With Mathematica 9, we have the addition of various processes, among which the discrete Markov process. Given a transition probability matrix m, such a process is ...
3
votes
2answers
220 views

How to create a 'shortest-path link matrix'?

I am currently struggling with a problem in Mathematica. I have a randomly generated weighted Barabasi-Albert graph and a corresponding demand matrix of the same size. I'm generating the graph with ...
6
votes
1answer
117 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 ...
0
votes
1answer
75 views

Turning sound into a graph

I'm writing a comprehensive text on graphs and Mathematica and in this context I have this, let's call it, creative gap between sound and graphs. There are plenty of ways one can create graphs from ...
1
vote
1answer
48 views

How to convert a sparsearray to a graph?

s = Import["hello.mat"]; t = GraphEmbedding[Graph[s[[1]]], "GridEmbedding"]; I get the following error: GraphEmbedding::graph: A graph object is expected ...
3
votes
5answers
195 views

Ordering the Boundary points of a Polygon

I feel like this should be simple, but I keep running into walls. Say someone gives you the coordinates of the vertices of a pentagon and the center point of the hexagon. Is there any way to get an ...
3
votes
0answers
76 views

Citation of the algorithms used in FindGraphCommunities

For my research work I need to put a comparison of different community detection algorithms. Instead of implementing all those algorithms once again, I would like to use the methods already provided ...
4
votes
3answers
436 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 ...
4
votes
2answers
191 views

Coordinate extraction and manipulating graphs as graphics objects

Consider the image below: GraphData[{"Wheel", 7}] Is it possible in Mathematica to lay several of these Graph along each ...
1
vote
1answer
43 views

Importing additional custom data in DIMACS format

I have graphs in DIMACS format, with vertex colors specified. The vertex colors are denoted by lines n u c, where u is the ...
8
votes
3answers
394 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 ...
1
vote
1answer
41 views

Using FindGraphCommunities, write community membership for each vertex to CSV

I have a network that I've loaded into Mathematica, and I've used FindGraphCommunitites[network,Method->"Hierarchical"] to identify the communities in the ...
3
votes
1answer
95 views

Expected graph distance in random graph

I am trying to use the functionality of Expectation and Probability for random graphs, in particular for percolation models. ...
2
votes
2answers
109 views

Positioning Vertices in a Graph

I made a graph that has a given number at each vertex: I want to place vertex 1 above vertex 2 if value of vertex 1 is larger than of vertex 2. And also, vertices with same value should be located ...
5
votes
1answer
70 views
1
vote
1answer
182 views

Vertex labels versus vertex names in VertexRenderingFunction

The VertexRenderingFunction seems to only use names, not labels. For example: ...
2
votes
1answer
179 views

Plotting attributes of vertices in WattsStrogatzGraphDistribution[n, p, k]

I have a graph WS = RandomGraph[WattsStrogatzGraphDistribution[n, p, k]]. I need to plot several characteristics of each v: the ...
2
votes
1answer
96 views

Want to label vertices of a graph and manually move them around

I would like to plot a graph in such a way that The vertices are labeled using labels that I've given them, rather than just their number, I can manually move the vertices around. In the code ...
0
votes
2answers
206 views

Plot “number of triples at each v in V(G)” [closed]

For a uni assignment, I need to plot the "number of triples at each v in V(G)". I tried to find relevant information in the Mathematica documentation through Google, but I'm lost. How do I get the set ...
2
votes
1answer
42 views

Fix the size of vertices and arrow in graphs

I defined an option to draw nicely the graph. But I have a problem with the different size obtained. For example, the layout of the first graph is what I want to have for all other graphs I will ...
3
votes
2answers
67 views

How to get all leaves from a graph's specific node

Let's say I have this graph (The code to generate the graph is at the end) How can I extract all the leaves comming from, let's say "cluster3"?, i.e. {100, 92, 87, 89} I guess I have to first ...
5
votes
1answer
241 views

Implementing local complements of graphs

I'm trying to write a routine which generates the local complement of a graph at a vertex. For those who don't know, the local complement for a singly-connected, undirected graph is defined as the ...
0
votes
0answers
42 views

Graph plotting: specify layers for layered drawing

Mathematica can do layered graph drawing with LayeredGraphPlot or GraphLayout -> "LayeredEmbedding". Is it possible to ...
7
votes
2answers
276 views

Mathematica 10 Graph issue

Please try to evaluate this code in Mathematica 10. ...
3
votes
0answers
116 views

Undirected Network and its Monte Carlo Simulation

So I have this array of points, in the form {x, {y,z}}, where x is the node number assigned when I used the locator pane to make a network, and y and z are its unitary coordinates. The graph is made ...
4
votes
1answer
115 views

Agglomerate output to Graph

I'm using the HierarchicalClustering package to cluster some data. So let's say I have this: ...
3
votes
1answer
114 views

Cellular Automata Neighborhood as Node connections

Can I use the CellularAutomation[] function where the neighborhood is defined by the connections between nodes? For example, if 1 -> 2, 1 -> 3, 1 -> 8, 1 ->1, then the neighborhood of node 1 is the ...
3
votes
0answers
42 views

Does anyone know the options for “HierarchicalEdgeBundling” in Mathematica?

I'm looking to reproduce the types of graph layout that are possible in D3 (http://bl.ocks.org/mbostock/7607999) in Mathematica. Since Mathematica doesn't explicitly support force directed edge ...
3
votes
2answers
116 views

Harmonious graph labeling

Is it possible to harmoniously label a graph in Mathematica? I would like a function, that when given a graph, would return a harmonious labeling. If not, is there other software that can do it? A ...
2
votes
4answers
96 views

How to plot a graph from it's incidence matrix?

I'm using Mathematica v9 and am trying to draw a graph by using it's incidence graph, but it won't draw it, which occurs an error "is not a valid incidence matrix.". But I've checked my matrix, and ...
6
votes
2answers
263 views

How to color edges of a graph which has multiple edges connecting certain vertices

I'm studying BIBD(Balanced Incomplete Block Design) and want to draw some graphs by coloring their blocks in different colors, respectively. A block is a collection of edges (or vertices). For ...
2
votes
1answer
49 views

Hungarian Algorithm using BipartiteMatchingAndCover Function

I have a bipartite graph with two sets of vertices. ...
4
votes
1answer
87 views
2
votes
2answers
222 views

Manipulate graphs in 3D

Is it possible to Manipulate Graphs (e.g. a ...
18
votes
5answers
915 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
9k 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
228 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
46 views

Make AdjacencyGraph hide single unconnected elements

Is there a way to force AdjacencyGraph to hide single unconnected or self connected elements? ...
8
votes
1answer
166 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 ...
13
votes
2answers
558 views

Animating transition between all graph representations obtained from curated data

Pappus graph is one of many graphs whose various data is contained within Mathematica. Mathematica typically keeps several ways of representing such graphs: ...
5
votes
3answers
157 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
82 views

Generate Random 3D Network using GraphPlot3D and loop

Instead of writing all this out I want to do the same thing with a loop and be able to manipulate n and k. The idea is to create a randomly generated network where n is the number of nodes and k is ...
14
votes
2answers
796 views

Drawing pairs (graph, circle packing)

Circle packing theorem states: For every connected simple planar graph G there is a circle packing in the plane whose intersection graph is (isomorphic to) G. How to use Mathematica to draw examples ...
0
votes
1answer
163 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
80 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
460 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 ...
2
votes
3answers
256 views

How to find a path that traverses each edge of a graph exactly twice?

I have a question regarding a graph traversal problem. This is the graph I am working with: ...
28
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, ...