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)

7
votes
1answer
296 views

How to visualize the structure of this dynamic programming code

I am studying Mr. Wizard's answer to this question which tries to identify elementary circles in a graph. That answer uses dynamic programming technique to simplify the code. The underlying guideline ...
1
vote
3answers
124 views

Deleting Vertices in GridGraph

Take a simple GridGraph: g = GridGraph[{3, 3}, VertexLabels -> "Name", ImageSize -> 150, ImagePadding -> 10] I am ...
4
votes
2answers
174 views

Visualize difference between members of the list

I want to visualize the difference between members of a set: set = {20, 36, 70, 96, 152, 301} This way I get the diffs: ...
3
votes
2answers
187 views

Manually adjust graph vertex location by dragging?

Sometimes I have a graph and I want to make tweaks to the vertex locations. Is there any way to manually adjust graph vertex location by dragging? If I double click to edit, I can move around the ...
2
votes
1answer
227 views

Nicely illustrating the evolution and end-state of a discrete-time Markov chain

I'm simulating a discrete time Markov process on a finite state space corresponding to a linear interval $(x_1, x_2, ..., x_N) \in X$, where each time step $t_i$ involves updating the state of some ...
4
votes
2answers
153 views

Total weight of a graph

I need to find the total weight of an WeightedAdjacencyGraph. I have a graph in that form ...
0
votes
1answer
119 views

GraphPlot3D: How to plot undirected graph with a list of edges?

I have a list of edges defined based on vertices like this: ...
0
votes
1answer
63 views

Subgraph, HighlightGraph not acting as expected

I'm trying to create a simple graph from a matrix and then highlight a particular subgraph. My code (simplified from a bigger task) is as follows. I keep getting the "Subgraph::graph: A graph object ...
0
votes
1answer
128 views

How to construct a graph from a list of edges

I have a list of pairs of numbers, representing connections between objects in the real world. Each number is the identifier of an object, there are gaps in the range from the smallest number to the ...
2
votes
2answers
282 views

random geometric graph generation problem

I'm new to Mathematica. I'm trying to generate a random geometric graph in which to have a secure link between any two arbitrary nodes they should share a common key in their key rings (have assigned ...
20
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.
3
votes
2answers
162 views

How to apply GraphLayout to parts of a graph?

I'm trying to sketch polymers. Here is how I do it for the monomer: ...
1
vote
1answer
164 views

Vertex labels versus vertex names in VertexRenderingFunction

The VertexRenderingFunction seems to only use names, not labels. For example: ...
1
vote
1answer
101 views

GraphPlot with black edges no rendering function

Is there any way to make the edges of a GraphPlot black without tediously writing out a long "EdgeRenderingFunction"? I guess you could ask the same kind of question about vertex labeling. For ...
3
votes
1answer
268 views

Generating a graph object where vertices are pixel coordinates and edges represent two pixels being in the same Moore neighborhood

I have a list of integer pixel positions, pts, and I wish to create one or more graph objects where vertices at these pixel positions share an edge if they are ...
3
votes
1answer
90 views

Is there really a bug in the following code, taken from the reference documentation for PetersenGraph?

PetersenGraph[5, 2, EdgeLabels -> {8 \[UndirectedEdge] 9 -> "hello"}] appears to evaluate perfectly, as expected, but in my version 9.0.1.0, the option ...
2
votes
1answer
177 views

GraphPlot labels overlapping

If I plot the following graph with an EdgeRenderingFunction, the position of both the labels are at dead center, and with a large graph I have the labels completely ...
15
votes
3answers
225 views

What is the most convenient way to change options for Graph[] objects?

What is the most convenient way to change options such as VertexLabels in existing Graph objects? (Version 7 users note: ...
13
votes
4answers
430 views

How to recompute the layout of a Graph?

I asked a question about changing Graph properties in a similar way to how Show can change ...
2
votes
3answers
389 views

GraphPlot only working when I evaluate twice

I have some code that builds a graph and some vertex coordinates, but when I evaluate it I get a message that the list of coordinates is not valid and the graph is not valid and it shows the output as ...
2
votes
1answer
157 views

Finding a Moore neighborhood connected path of bright pixels along the contour of a text character

I have a simple image, for example a blowup of a Times New Roman character like 'R' saved as a PNG. I then perform the following operations to extract a minimum representation of the contour lines ...
4
votes
1answer
144 views

Dijkstra without Combinatorica

There is some overlap between Combinatorica and the Graph related framework but there are also various elements missing. As far as I can see there is no 'Dijkstra' method or algorithm in Mathematica ...
0
votes
1answer
180 views

Mean path length of randomly generated graphs

I am looking to find the the average path length of 1000 random graphs with the following degree distribution, a few of the vertex degrees are included below ...
1
vote
0answers
59 views

GraphHighlightStyle with multiple datasets

I am trying to highlight several subgraphs of a graph using the following command: ...
5
votes
1answer
194 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: ...
0
votes
1answer
109 views

Connected components of a graph

I am trying to find the number of connected components of numerous named graphs within Combinatorica. The obvious answer seems to be: ...
4
votes
3answers
676 views

Minimum spanning Tree from a weighted adjacency graph

Note: Cross-posted at http://community.wolfram.com/groups/-/m/t/137658?p_p_auth=8QnKtT9I I have a really big graph, 40x40. Here is my code ...
3
votes
3answers
275 views

Generating a graph where vertices correspond to points in an integer lattice and edges connect points less than a threshold distance apart

I'd like to automatically generate a graph where vertices correspond to (and have the coordinates of) points in an $A \times B$ integer lattice, and a graph is generated by connected vertices within a ...
1
vote
0answers
124 views

Tools for finding minimal or almost-minimal graph vertex colorations in Mathematica v9?

I'm looking to compute minimum vertex colorations (s.t. no two vertices of the same color share an edge: http://en.wikipedia.org/wiki/Graph_coloring) for graphs in Mathematica v9 with potentially up ...
4
votes
3answers
598 views

How to find all graph isomorphisms in FindGraphIsomorphism

I found the second definition of the function FindGraphIsomorphism not working. Here's the definition Mathematica 8 gives: ...
2
votes
0answers
55 views

How to use Automorphisms[] on a graph? [duplicate]

I am having difficulty mixing the new post-Combinatorica graph data structure, with functionality apparently only in Combinatorica. I have constructed a graph using ...
9
votes
1answer
119 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 ...
1
vote
1answer
71 views

Assigning Variables for Degree Distribution [closed]

So my code is divided into 3 different sections: 1) Calculating clustering coefficient, 2) Extracting degree distribution 3) Using the degree distribution to get the mean of 1000 networks. ...
1
vote
2answers
297 views

Swapping elements of list

Say I have a directed graph inputted in the following format in Mathematica: g = {{1, "a", 2}, {2, "b", 1}} I'd like to plot this graph using ...
6
votes
2answers
231 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 ...
9
votes
3answers
390 views

Remove redundant dependencies from a directed acyclic graph

Given a directed acyclic graph, I want to remove all the edges $v_i \rightarrow v_j$ if $v_j$ is reachable from $v_i$ by some other path. Given the rich set of graph algorithms in Mathematica, what is ...
1
vote
1answer
122 views

Gradually coloring edges in terms of their vertices colors

In order to color Edges in a Graph after applying a function such as VertexDegree I did the ...
4
votes
2answers
114 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: ...
7
votes
0answers
303 views

Generating all spanning trees in an undirected graph [closed]

I was wondering if there is explicit source code for generating all spanning trees on undirected graphs. I don’t need anything very fancy – perhaps Minty's algorithm or Gabow & Myers. I've only ...
6
votes
3answers
272 views

Flow in pipeline graph

I have pipeline directed graph which has one source and several sinks ...
4
votes
1answer
162 views

Compatibility issues for Combinatorica package

I am trying to use the Combinatorica package in a Mathematica version 9 in the following code : ...
8
votes
2answers
233 views

Organise a graph's vertices into levels

I would like to organise a graph's vertices in levels. Consider ...
3
votes
3answers
173 views

Product of edge weights in path

I need to calculate the product of graph edge weights on the path taking into account edge direction. I.e. for graph ...
6
votes
4answers
184 views

Draw graph wherein vertices are ArrayPlots

I need to place ArrayPlots in the vertices of graph. i.e. in graph Graph[{1->2, 2->3, 3->1}] I have to replace vertex 1 with ArrayPlots[{{0,0,1}}] and ...
1
vote
1answer
119 views

Problem with GlobalClusteringCoefficient

I have a simple problem, I would like to measure the global clustering coefficient for a random graph. Here is my code: ...
1
vote
2answers
297 views

Coloring vertices using GraphPlot

I have the following problem: I used GraphPlot to plot my adjacency matrix. I divided my nodes in three groups: ...
3
votes
1answer
182 views

Merging Vertices of a Graph and adding up the edges weights

I have a Weighted Graph of g which looks like this. ...
0
votes
1answer
64 views

Testing Equality Expression?

Even if in Graph[{1 -> 2}] == Graph[{1 \[DirectedEdge] 2}] the answer is True ; but why MMA doesn't show the result of the ...
1
vote
3answers
143 views
2
votes
1answer
107 views

Distances of locations in the matrix form

I want to have the distances of the cities in the matrix form.How can I have it for example for the cities like followings that also includes the distance of the city from itself which is zero: ...