# Tagged Questions

Questions about handling graphs in Mathematica, graph theory, graph visualization, GraphPlot, the built-in Graph type and the Combinatorica package.

73 views

### Issues adding properties to multigraph

Unsupported Functionality (loosely, a bug) Mathematica (as of 10.3) does not support multi-graph where edge properties vary between two nodes that share multiple edges. Although this is not ...
77 views

### How to specify different colors for edges going between the same two vertices in Graph?

Here is an example: edge1 = Property[1 -> 2, EdgeStyle -> Red]; edge2 = Property[1 -> 2, EdgeStyle -> Blue]; Graph[{edge1, edge2}] This does not ...
60 views

I have a directed graph with this Edgelist defined as follow: ...
74 views

### How-to let user define a set of VertexCoordinates in a Graph

Here is a simple code I wrote to visualize what I am trying to achieve: C.1 ...
81 views

### How do I customize vertex label texts in tree plot correctly?

By the following code TreeGraph[{1, 2, 3}, {1 -> 2, 1 -> 3}, VertexLabels -> {"a", "b", "b"}] I get . This is incorrect. I need "a" to label the vertex ...
72 views

### Recursive graph expansion and rewiring

I want to take this graph and convert it into this graph by repeatedly substituting each of its nodes according to this rule After loading the initial graph and the substitution rule ...
213 views

### Calculate dual graph of planar Graphics map

This diagram from a Wikipedia article illustrates what I hope to accomplish in Mathematica: I have a planar map in Graphics format. Here are two very simple ...
110 views

### How to extract a Graph[] from an image?

This graph (as a picture) is given below: I am wondering rather than setting up this network graph using Mathematica syntax such as PathGraph,...
138 views

### Styling the edges of a graph according to the multiplicities of the edges

I used the following code to make a simple triangle, in which the nodes have different effects each other: ...
64 views

### calculate relationship between cause and effect (rows/columns/delta etc.) on tableform

I tried to enter this Excel (on the right of the picture) information to program. following these codes has been used: ...
99 views

### Delete vertices of degree 2 and rewire graph

I want to delete all vertices of degree 2 from a graph and rewire it. Given a graph like graphA, I want to obtain graphB. ...
154 views

### A question about weighted graphs

Bug introduced in 8.0 or earlier and persisting through 10.3 I need create a weighted graph with given data. Number of nodes: $53$ $\quad$ Number of edges: $91$ ...
91 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 ...
95 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 ...
57 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.
78 views

### Visualisation of feedback loops in a directed graph

Here are the nodes (vertices) of my graph: ...
32 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 ...
98 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 ...
66 views

### DiscreteMarkovProcess: labelling of states

Related, but it seems like the respondents there misunderstood the question. The following errors as DiscreteMarkovProcess::invsm: ...
119 views

### IsomorphicGraphQ fails to recognize that two empty graphs are identical

Bug introduced in 9.0.1 or earlier and persisting through 10.3.0 Consider the following two graphs: ...
39 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 ...
49 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 ...
62 views

### Count graphs with fixed number of vertices incluing isomorphisms [closed]

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 ...
187 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 ...
62 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: ...
168 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 ...
53 views

...
84 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}, ...
40 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 ...
258 views

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

Bug introduced in version 9.0 or earlier and fixed in 10.3 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 ...
42 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 ...
71 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: ...
92 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 ...
63 views

### Graph: vary color/length vertextlabels based on frequency

In this example I use a small network of 5 words. ...
85 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 ...
96 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. ...
64 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 built-in-function (...
47 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 ...
69 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 ...
97 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 ...
2k views

### Trying to Visualize a Collatz - The Collatz conjecture

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 a visual 3D adjacency graph of my ...
65 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"] ...
151 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 ...
76 views

### Powerset Animation/Invisible Vertices/Graph Layout

I wanted to visualize the cumulative powerset construction process and came up with two functions: ...
361 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 ...
44 views

### Unexpected behaviors with Edge Weights

Noticed some bizarre behavior when subgraphing on weighted graphs, which probably extends to graphs with arbitrary edge properties. I construct a weighted graph with five edges, defining a specific ...
230 views

### Possible improvements to this Syracuse (3x+1)/2 graph?

This algorithm produces the Syracuse disjoint tree graph without any duplicates. No need for Union, For, and ...
266 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 ...