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)

9
votes
2answers
492 views

Sierpinski carpet with GraphData

Is this graph in the list among the so-called "standard" structures used in GraphData? However, I have not found, yet, anything like "Carpet" or "Sponge" in the ...
2
votes
0answers
37 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 ...
10
votes
2answers
441 views

Removing edge weights from a Graph

How can I remove EdgeWeights from a Graph without affecting any other properties of the graph? Let's construct a graph with ...
31
votes
4answers
6k views

Finding all shortest paths between two vertices

The built-in FindShortestPath and GraphDistance functions find the shortest path between two particular vertices in a graph. I ...
5
votes
0answers
153 views

Finding quasi-cliques

What is the best way to identify quasi-cliques in a graph in Mathematica? I don't think it has been implemented, so are there any solutions to do this? Or do I have to export the graph data somehow ...
11
votes
4answers
473 views

Efficient setting of properties of multiple vertices in Graph

The functions SetProperty and PropertyValue can only set a single property of a single vertex, as far as I know. How do I set a ...
2
votes
1answer
97 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 ...
5
votes
2answers
143 views

How to show the direction of highlighted path in graph

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

Vertex Order of Graph

Given a graph, I want to find the shortest distance between each pair of vertices: ...
3
votes
2answers
85 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 ...
6
votes
1answer
230 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 ...
2
votes
2answers
77 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
61 views

Unexpected AdjacencyMatrix output [duplicate]

I have a directed graph with this Edgelist defined as follow: ...
2
votes
2answers
76 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 ...
25
votes
2answers
3k views

How to plot planar graphs as such?

A planar graph is a graph that can be drawn in the plane such that no two edges cross. For example, the graph ...
1
vote
1answer
116 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 ...
4
votes
1answer
89 views

How can I change VertexWeights in a Graph?

Bug introduced in 9.0 or earlier and fixed in version 10.0.0 I evaluate ...
4
votes
1answer
127 views

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

Bug introduced in 9.0.0 and fixed in 10.0.0 PetersenGraph[5, 2, EdgeLabels -> {8 \[UndirectedEdge] 9 -> "hello"}] appears to evaluate perfectly, as ...
11
votes
3answers
562 views

Mathematica 10 Graph issue

Bug introduced in 10.0.0 and fixed in 10.0.2 Please try to evaluate this code in Mathematica 10. ...
1
vote
2answers
147 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: ...
6
votes
0answers
69 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 (...
2
votes
0answers
76 views

What Algorithm Does Mathematica use to Calculate Betweenness Centrality for Unweighted Graphs?

I recently asked this question on the Mathematics SE. Does anyone know, as a follow up, what algorithm Mathematica uses to calculate the betweenness centrality vector (of $N$ elements) for an ...
1
vote
1answer
96 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 ...
1
vote
1answer
68 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
114 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. ...
13
votes
2answers
352 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
184 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 ...
4
votes
1answer
158 views

References on functions FindGraphPartition and FindGraphCommunties

Does somebody have some interesting references on the FindGraphPartition and FindGraphCommunties[.., Method -> "Spectral"] ...
0
votes
1answer
63 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
102 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
112 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
203 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
664 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
33 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 ...
23
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 ...
9
votes
1answer
138 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 ...
0
votes
1answer
41 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
54 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
66 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 ...
5
votes
1answer
184 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
70 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
89 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
46 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 ...
1
vote
0answers
88 views
2
votes
3answers
187 views
3
votes
1answer
52 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 ...