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)

2
votes
0answers
33 views

Algorithm to determine if two colored graphs are isomorphic? [duplicate]

I have two (vertex-)colored graphs. I want to determine if they are isomorphic, with the condition that the isomorphism respects the colors of the vertices. Moreover, I want the algorithm to output ...
2
votes
1answer
76 views

Multiple colors on a single graph edge?

Is there any way to put two colors on one single graph edge? For example, I want to highlight two cyclic paths (red and blue). But, if I put the two colorings into one image, it does not work as I ...
1
vote
0answers
56 views

GraphDistance gives incorrect result in weighted multigraph [closed]

There are bugs in Graph on Mathematica 10.1. For example, ...
5
votes
2answers
77 views

How to show the direction of highlighted path in graph

I am trying to show the direction of FindHamiltonianPath on the Graph. ...
5
votes
1answer
89 views

Vertex Order of Graph

Given a graph, I want to find the shortest distance between each pair of vertices: ...
3
votes
0answers
47 views

Issues adding properties to multigraph

Today I was working with a large multi-graph with properties on the edges when I discovered that properties aren't assigned as expected. My preferred graph construction method is to specify ...
3
votes
2answers
67 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 ...
1
vote
1answer
50 views

Unexpected AdjacencyMatrix output [duplicate]

I have a directed graph with this Edgelist defined as follow: ...
2
votes
2answers
63 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 ...
1
vote
1answer
39 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 ...
2
votes
2answers
61 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 ...
5
votes
1answer
178 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 ...
3
votes
0answers
72 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,...
1
vote
2answers
109 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: ...
1
vote
1answer
57 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: ...
6
votes
2answers
78 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. ...
12
votes
0answers
121 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$ ...
1
vote
1answer
84 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 ...
5
votes
1answer
84 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 ...
0
votes
1answer
54 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.
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 ...
3
votes
2answers
77 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 ...
10
votes
1answer
92 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: ...
0
votes
1answer
32 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
35 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
39 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 ...
8
votes
2answers
142 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 ...
2
votes
2answers
52 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: ...
5
votes
1answer
135 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
0answers
66 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
217 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. ...
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
42 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
74 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 ...
4
votes
2answers
56 views

Graph: vary color/length vertextlabels based on frequency

In this example I use a small network of 5 words. ...
0
votes
2answers
60 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 ...
6
votes
1answer
92 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. ...
6
votes
0answers
61 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 (...
1
vote
0answers
42 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
56 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 ...
2
votes
1answer
60 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 ...
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 ...
4
votes
1answer
56 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"] ...
1
vote
2answers
85 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 ...
1
vote
1answer
67 views

Powerset Animation/Invisible Vertices/Graph Layout

I wanted to visualize the cumulative powerset construction process and came up with two functions: ...
8
votes
2answers
286 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 ...
1
vote
0answers
35 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 ...