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
1answer
163 views

Systemic bugs in GraphPlot and related functions such as TreePlot and TreeForm

Bug introduced in 7.0.1 or earlier and persisting through 10.2.0 I believe I have come across a rather curious bug in TreeForm: ...
1
vote
1answer
56 views

How to find a cycle with a property in a graph

Let's have a graph with this edge list: edgelist = {s -> 1, s -> 2, 1 -> 3, 2 -> 1, 2 -> 4, 3 -> 2, 3 -> t, 4 -> 3, 4 -> t}; I want ...
11
votes
0answers
97 views

A question about weighted graphs

Bug introduced in 8.0 or earlier and persisting through 10.2 or later I need create a weighted graph with given data. Number of nodes: $53$ $\quad$ Number of edges: $91$ ...
11
votes
2answers
317 views

Why is NeighborhoodGraph so slow?

To get neighboring vertices I first tried: gg = GridGraph[{10, 10, 10, 10}]; VertexList[NeighborhoodGraph[gg, 1, 1]] // AbsoluteTiming {5.539308, {1, 2, 11, ...
3
votes
2answers
152 views

CommunityGraphPlot doesn't size

Bug introduced in 9.0 and fixed in 9.0.1 When I need to plot a 'large' graph with CommunityGraphPlot the output is always sized at the Mathematica default value. The Graph object itself can be ...
3
votes
1answer
137 views

References on functions FindGraphPartition and FindGraphCommunties

Does somebody have some interesting references on the FindGraphPartition and FindGraphCommunties[.., Method -> "Spectral"] ...
0
votes
1answer
48 views

How to check if (u,v) and (v,u) edges are in a given directed graph

I have a graph and i want a module to run through all the edges of this graph and check whether (u,v) edge is in this graph and (v,u) edge is in another given graph.
5
votes
1answer
73 views

How to create a MorphologicalGraph from MorphologicalBranchPoints

I want to select the morphological branch points of a thinned image to create a MorphologicalGraph like the one obtained by Pruning. I want to avoid the pruning step. How can I delete from the ...
3
votes
2answers
72 views

Coloring network edges by weight using GraphPlot

Following up on a previous question about how to color the nodes (vertices) of a network (graph) according to a color scaling of a property of those nodes, I'm now asking basically the same thing ...
8
votes
2answers
129 views

Efficient solution for a discrete assignment problem with pairwise costs

Let's consider a simple graph with N vertices, and a corresponding set of N items. The goal of the problem is to assign every item to a vertex on the graph so that sum of a per-edge (that is ...
10
votes
2answers
578 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: ...
0
votes
0answers
29 views

Weighted graph vizualization [duplicate]

Is it possible to visualize a weighted graph, so lines on screen would reflect weight? I.e., be longer, or shorter depending on edge weight? Slight OT: which graph visualising libraries/tools can do ...
21
votes
2answers
1k views

Drawing pairs (planar 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 ...
10
votes
1answer
89 views

IsomorphicGraphQ fails to recognize that two empty graphs are identical

Bug introduced in 9.0.1 or earlier and persisting through 10.2.0 Consider the following two graphs: ...
7
votes
1answer
97 views

Setting PropertyValue for VertexWeight is not persistent

Bug introduced in 9.0.2 or earlier and fixed in 10.0 ...
9
votes
2answers
213 views

Self-loops in Graph may not display correctly or export correctly to PDF (due to BezierCurve problem)

Bug introduced in 10.0 and persisting through 10.2.0 Problem is due to a BezierCurve bug. I don't understand why the following does not work: ...
9
votes
1answer
129 views

FindHamiltonianCycle is not invariant to edge permutation

Bug introduced in 9.0.1 or earlier and fixed in 10.0 Found this bug-like behaviour today: if the order of edges is changed so that VertexList does not return the ...
10
votes
2answers
196 views

Finding the minimum vertex cut of a graph

Bug introduced in 9.0.1 or earlier and fixed in 10.2.0 Note: FindVertexCut is new in 9.0. It seems that Mathematica is not correctly finding the smallest set of ...
5
votes
0answers
49 views

VertexDelete not working on graph with VertexWeight

Bug introduced in 10.0 and persisting through 10.2.0 Good afternoon, I have observed an "unexpected behaviour" with VertexDelete and a graph with vertex weights. This is a minimal working example: ...
11
votes
1answer
85 views

Question about TransitiveReductionGraph

Bug introduced in 10.0 and persisting through 10.2.0. Note: TransitiveReductionGraph is new in 10.0. In Mathematica 10.0 and 10.1, according to the ...
0
votes
1answer
30 views

How to perform operations with vertices from any edge on a Graph object

I'm trying to get the vertices from an large list of edges on a Graph object in Mathematica 10. I need to operate them, adding, substracting dividing. As an ...
0
votes
0answers
34 views

Why does (Layered)GraphPlot lose labels and renumber vertices?

I define a graph of numbers as vertices, but also labeled, like g=Graph[{Labeled[1 \[DirectedEdge] 5, "text1"]…},VertexLabels -> {79 -> "text2",…}]. This is ...
2
votes
1answer
36 views

Count graphs with fixed number of vertices incluing isomorphisms

I'm trying to use the listgraph function in the Combinatorica package: Needs["Combinatorica`"] g = ListGraphs[5]; ShowGraph /@ g However, it only returns all the ...
2
votes
1answer
58 views

Finding nonequivalent 3-cycles and edges of a given graph

So I have three graphs defined by the following nested list, I'm using this list notation instead <-> notation because it is more convenient for another part ...
1
vote
2answers
73 views

Graph generation from a non-paired edge list

The elements in e = {{6414, 6598, 6927}, {7, 1035, 2382, 6927}, …} are the graph nodes; for example, {6414,6598,6927} is ...
5
votes
1answer
127 views

Arbitrary shape GridGraph

There is a function GridGraph that generates a finite square lattice graph. Is there a way to make a generalized solution (e.g. with hexagons, or triangles instead of squares)? To put it in more ...
2
votes
2answers
50 views

Network Graph: show highly connected components

I want to create a network graph without the small subgraphs which are disconnected from the big network graph. Suppose I want to visualize the edgelist: ...
2
votes
0answers
45 views

Functionality of FindMaximumFlow

I know that the superseeded function NetworkFlow (needs Combinatorica) uses Goldberg-Tarjan's Push-Relabel-Algorithm but i cant find any information on Mathematica's build-in-function ...
2
votes
0answers
64 views

Graph, overlapping vertexlabels

The graph I create is based on more then 1000 different word-combinations. A example looks like this: text = {{word, word1}, {word1, word2}, {word1, word3}, {word,word4}, {word,word5}, ...
1
vote
1answer
36 views

Can I rely on the ordering of the adjacency matrix? [closed]

Suppose I have created a Graph[{1,2..n}, {1->3, etc}], and I take the adjacency matrix of that graph. Can I rely on the fact that the i-th entry in the graph is the i-th node in the matrix? Or maybe ...
4
votes
1answer
204 views

Why don't the arrowheads show for this directed graph?

It's very weird, but the first graph is shown as undirected (dots connected by lines, not arrows. The second is shown as directed, with arrows. I'm using the cloud version of Mathematica. ...
1
vote
0answers
69 views
3
votes
1answer
27 views

How can I get the vertex labels of an existing graph?

For example, if there is a graph g = CompleteGraph[5, VertexLabels -> {1 -> "v1", 2 -> "v2", 3 -> "v3", 4 -> "v4", 5 -> "v5"}] How can I later ...
0
votes
1answer
32 views

Compute complete graph and make minimum spanning tree

I'd like to plot a complete Graph and then compute the Minimum spanning tree of it. I already can make a complete graph out of a list that countrydata gives me: ...
4
votes
2answers
70 views

Iterative Tree Plot for the Sum of an Integer's Digits Squared

I am trying to make a graph that depicts integers<100 mapping to the sum of their digits squared. I can do this for one iteration, but I don't know how to do it for more than one, or until the new ...
0
votes
2answers
58 views

What is the correct way to assign and use properties of vertices in graphs?

I'm using Mathematica 10, but I'm having a hard time getting it to do anything useful for network analysis because I'm having a hard time working with node properties and analyzing the graph by its ...
4
votes
2answers
54 views
6
votes
1answer
88 views

Slow-down encountered for RandomChoice in large lists

I was wondering if anyone could help me to speed up this code snippet which creates simple (sparse) networks by preferential attachment. The algorithm adds a vertex and an edge each time interval. ...
1
vote
1answer
97 views

Computing Domination Numbers of Graphs

Is there a way to get Mathematica to compute the domination number (size of the smallest dominating set) of a graph? There doesn't seem to be a direct command for this, so I'm not sure if there would ...
1
vote
0answers
40 views

reset the value of a variable [closed]

Folks, I have a problem in populating a matrix without overriding the values. After performing computations for various values for j, I want to store these values in following matrix. Here is the ...
0
votes
0answers
54 views

Shortest Common Superstring for all k-length strings on an alphabet

Given all strings of length $k$ of an alphabet of size $n$. This gives $n^{k}$ strings. Now I want to create one superstring that contains all these strings as substrings. They hopefully strongly ...
22
votes
2answers
1k views

Trying to Visualize a Collatz - The Collatz conjecture

So I'm new in this and learning--- and I happen to have this collatz collatz[x_, y_] := If[x == 3*y || x == 2*y + 1 || y == 3*x || y == 2*x + 2, 2, 0] So i want ...
5
votes
1answer
110 views

Efficiently find all connected subgraphs

Is there a way to generate all the connected subgraphs of a graph in mathematica without going through all the subsets of the nodes and checking if the subgraph is connected (which will be ...
2
votes
1answer
370 views

Display a labeled multigraph

Introduced in version 9, fixed in version 10. Thanks Szabolcs for providing this screenshot showing that the bug is fixed. Despite the integration of graphs and networks, multigraphs are ...
2
votes
1answer
171 views

Distinguishing left from right adjacent triangles in triangle mesh [closed]

What I'm trying to do: I'm trying to create a path-drawing function which will produce a path like the one I-P in the diagram below. The way this path was generated requires me to swap between the ...
4
votes
1answer
46 views

Why does TreePlot ignore the vertex labels in a TreeGraph argument?

Example (watch the vertex labels): aTree = TreeGraph[{"a" -> "b", "a" -> "c"}, VertexLabels -> "Name"] ...
9
votes
2answers
224 views

Relaxation of Mass-Spring System with Pinned Masses

Problem Assume that four masses are connected to each other by springs while two of them are pinned down at their initial positions. Find the position of masses when system is at its minimum ...