# Tagged Questions

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

100 views

### Visualizing Matrix that represents a network

I have a nxn matrix $A$ that represents a network. I have $n$ nodes in the network, and the matrix $A$ represents the number of connection (edges) between the different nodes. For example, if $A$=0, ...
116 views

### Networkgraph, Thickness of edges based on calculated values

On this blogsite I've read a interesting blog about visualising a correlation matrix. So I started with a simple file like: ...
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 ...
87 views

### Labeling the vertices of a graph

I would like to label the vertices of a complete graph alphabetically. But I am stuck because I don't know how to associate only one vertex to a letter. ...
44 views

### Medium-sized graph won't build

Why can't Mathematica import a 40-KB file (mediumEWD.txt) and build the underlying graph in some decent time? I waited a minute, nothing. ...
622 views

### Binary decision diagrams (BDD)

I would like to use Mathematica to help me simplify a given Binary Decision Diagram (i.e. pick the optimal variable ordering). I don't seem to find anything at all on the topic, although it is ...
57 views

### Highlighting a graph with non-trivial vertex definitions

When defining a graph whose vertices are sets e.g. the Kneser graph, how does Mathematica interpret the vertices? I am having trouble highlighting vertices when I define vertices with sets, but for ...
69 views

### Vertices overlap with vertex labels

How to prevent a behavior on a picture below? Why vertices overlap with vertex labels? ...
54 views

### How to change vertex font size in TreeGraph?

I tried to change vertex label font size by the following code ...
82 views

### How do I change one edge in a tree graph to a double arrow?

I use the following code plot a binary tree and wants to change an edge to double arrow. ...
320 views

### Citation of the algorithms used in FindGraphCommunities

For my research work I need to put a comparison of different community detection algorithms. Instead of implementing all those algorithms once again, I would like to use the methods already provided ...
220 views

### Draw a de Bruijn graph with random vertex size

I am trying to draw a graph that looks like below, This the code I have so far, ...
73 views

### Getting error from CommunityGraphPlot

Situation I'd like analyse my web site with CommunityGraphPlot as follows: Step 1: Define a function to scrape the all the webpages from expected website. ...
87 views

### Deleting isomorphic graphs efficiently

I'm trying to delete isomorphic graphs from a large list. My solution is as follows: DeleteIsoG1[gl_List]:= Module[{}, DeleteDuplicates[gl,IsomorphicGraphQ]]; ...
536 views

### Listing subgraphs of G isomorphic to SubG

If I have an undirected graph G, how could I write a function in Mathematica to obtain a list of subgraphs of G that are isomorphic to some other undirected graph SubG? I'd like to learn how to ...
68 views

### Deleting Isolated subgraph in a graph

Suppose I have a graph GraphPlot[{1 -> 2, 2 -> 1, 3 -> 1, 3 -> 2, 4 -> 1, 4 -> 2, 4 -> 4, 5->6}] Now I want to identify the vertices of a subgraph which are isolated from the main graph.(In this case ...
73 views

### Cannot get Mathematica to recognise Vertex Weights of Graph

I am using Mathematica Version 8.0 I've tried variations of the following commands, in order to assign the weight $1/k$ for vertex $k$, for a graph defined on {1,2,..,n} via the edge rule (k,k') \...
4k views

### How to get graph layout that reflects edge weights?

My heart soared to discover that Mathematica 8 offers support for specifying a weighted adjacency matrix in WeightedAdjacencyGraph. But it seems that, regardless of the weights between edges, the ...
287 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 ...
78 views

### Generate all directed graphs with n vertices, + additional constrains

I have a problem similar to Using GraphData to generate all directed graphs with n vertices. That is, I want to have all directed graphs with n vertices (particularly, for n = 4). However: not up ...
97 views

### Smallest connected subgraph containing all given vertices

Given a connected graph $G$ and a subset of its vertices, $S$, I need to find the smallest connected subgraph of $G$ containing all of $S$. How would you approach this in Mathematica? I am asking ...
144 views

### How do I find all cut vertices (aka articulation points) in a graph?

Given a connected graph $G = (V,E)$, we say that a vertex $v \in V$ is a cut vertex of $G$ if the removal of $v$ from $G$ causes $G$ to become disconnected. How can I find all cut vertices of a given ...
91 views

### network visualization with different colors for different edge labeled

I have a network with 3 different edge types, edgelist file is a three column file with id1, id2 and edge label. I uploaded the file here What I need know is to find a way to plot this network, as ...
113 views

### How to plot a graph with some disconnected vertices?

I am trying to plot a graph with $6$ vertices but I do not want some of the vertices to be connected. I have drawn a picture to illustrate my problem. So far I know how to plot $6$ vertices without ...
284 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 ...
54 views

### what causes this display problem (missing arrows) with this adjacency graph [duplicate]

AdjacencyGraph[{{1, 1, 0}, {0, 0, 1}, {0, 0, 1}}, DirectedEdges -> True] If you look very closely at the resulting visual display in a notebook (below), you ...
315 views

### Is there something akin to “SubgraphIsomorphismQ” in Mathematica 9?

Provided two unlabeled graphs, $G$ and $H$, I would like to test where $H$ is a subgraph of $G$. In other words, I'd like to test whether we can prune some fixed number of vertices or edges from $G$ ...
63 views

### Spatial Display of “Union of Geodesics” in a Random Geometric Graph

After reading.... Finding all shortest paths between two vertices which addresses an important topic in Mathematica graph visualisation, I use ...
240 views

### Finding a complete subgraph efficiently

I'm working on some experimental algorithms which would benefit from methods to find an instance of complete subgraphs with N vertices in an undirected graph. This far I've tried these methods: <...
57 views

### Visualizing site map using a Tree

I've been trying to visualize a sitemap for analysis purposes. So far, using Leonid Shifrin's makeTreeRojo function, I've been able to build a somehow decent visualization. First, I fetch and format ...
68 views

### Changing edge weights in a graph using PropertyValue

I encountered a problem trying to change the EdgeWeights in a graph. I am runnning Mathematica 10.1 under Windows 7 Enterprise. I have an undirected graph with 144 nodes and 576 edges. I first ...
273 views

### Custom edge style (e.g. brush stroke, writing ink, etc.)

I would like to draw a graph with Mathematica in such a way that it looks like a handmade drawing or painting. To be more precise, is there a way to set a custom edge style such that it looks made ...
439 views

### Counting paths of a certain length between a source and sink vertex

I have a graph $G$, which may be directed or not, and I was wondering if there was an efficient way of using, say, BreadthFirstScan[] and FindShortestPath[] to count the number of paths between some ...
43 views

### Depth limited search in mathematica

I often use FindPath[G, 1, 2, {L}, All] where $G$ is some graph. This finds all paths of length exactly $L$ edges which run between nodes $1$ and $2$. In large ...
600 views

### Visual representation of a Ranking over time (image provided)

[Disclaimer: I initially posted this question on stackOverflow 2 months ago and think it might be better suited for this forum (link to original question)] The graph below shows a ranking of ...
80 views

### Mathematica in Action (Wagon) — code to generate a great circle is giving error [closed]

I have code from Stan Wagon's Mathematica in Action, Chapter 17 (Great Circle Problem), but when I try to run it, it does not work. I have Mathematica 10. The code that does not run is shown below. Do ...
625 views

### Isomorphisms for graphs with loops and multiple edges

I am working with graphs with multiple edges and loops, and I want to eliminate all isomorphic graphs from a long list I've generated. The FindGraphIsomorphism ...
488 views

### Import and Plot Git Commit History

What might be the easiest to import and plot all commit history for a github project? I'm looking for something similar to the following.
52 views

### How to set distance between connected vertices in graph?

I'm new at making graphs in mathematica 9, so I don't know if this question is contained in some of already asked ones. I started making it to visualize a polytope, which is build by a sertain ...
170 views

### Fast way to get edge-list of graph in terms of vertex indices (not vertex names)

I am looking for the fastest way to achieve the following: Given a Graph, retrieve its edge list in terms of vertex indices (not actual vertices). For example, ...
58 views

### How best to use or to emulate the “obsolete” Combinatorica command Contract?

The obsolete Combinatorica package has a command Contract for contracting an edge in a graph. Below is my very clunky attempt to work with up-to-date graph objects ...
1k views

### How can I conveniently call igraph from Mathematica?

Mathematica has lots of functions for working with graphs and networks, but there are still some functionality holes that are provided by other packages. Also, due to the nature of graph theory, ...
54 views

### TreePlot: arrows on specific lines

I have the following list of rules: L={1->2,2->3,3->3}; and I want to plot a tree graph: ...
31 views

### WeaklyConnectedGraphQ evaluates to False. Is this the expected result?

Take the simple graph {1->2, 2->3, 3->1}: TreePlot[{1->2,2->3,3->1}] I would expect that ...
370 views

### Is there a bug in FindClique?

If h is a graph, FindClique[g, {n}] should return a clique on exactly $n$ vertices if one exists in ...
135 views

### How to use DegreeGraphDistribution with directed graphs?

DegreeGraphDistribution supports directed graphs because it has a DirectedEdges option. How can I specify the in-degree ...
244 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 ...
1k views

### Fast code to generate large random graph with fixed degree sequence

I'm trying to create a function so to generate large random graph with a fixed degree sequence $\{v_1,v_2,\dots,v_N\}$, where $N$ is the number of vertices in the graph. The Mathematica function that ...