# Tagged Questions

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

93 views

### Successive addition or deletion of vertices (or edges) in graph

I am trying to perform a kind of dynamic graph simulation where vertices and edges of graph are added and deleted according to the current state of the graph at each time step. I know that there are ...
155 views

### Random geometrical graph generation

I would like to generate a random graph on $[0,1]^2$. Each node is connected to one other if the distance between two nodes is say 1/4 or less. Here is an example with 50 nodes and 200 edges I would ...
61 views

### Trying to write a program to find an approximate harmonic function on a given graph using relation method

So given an undirected graph with two vertices that have fixed values assigned to them, a harmonic function is a function that assigns values to all other vertices such that the value assigned to each ...
297 views

### VertexRenderingFunction (or EdgeRenderingFunction) with movable nodes?

In GraphPlot, I'd like to use VertexRenderingFunction (VRF) and have the resulting object behave the same way under dragging verticies as it does when I do not use VRF. The same issue occurs for ...
67 views

### What do the default shapes/colors in DiscreteMarkovProcess Graph mean?

In making markov chains, I know how to do that, but I am curious as to what the different colors, and shapes of the vertexes in the graph output mean. as example; ...
64 views

### EdgeRenderingFunction For 2 Vertices in a Loop

Assume there is a set of rules: set = {"A" -> "B", "B" -> "A", "B" -> "C", "C" -> "D", "D" -> "A", "C" -> "C"}; which we want to graph using <...
69 views

### Efficiently or Elegantly construct linear graph list from vertex pairs

I am processing MRP data, with BOM relations as pairs of part number strings. I want to construct lists that represent the linear graphs defined by these pairs. Here is some code to generate random ...
34 views

### FindIndependentEdgeSet behaves differently in v9 and v10

The following code gets different output in v9 and v10. ...
214 views

### Drawing a path which realises the diameter of the graph

So I enter a (0,1) adjacency matrix and I get the following graph: The diameter of this graph is 4. How can I ask that two vertices which realise this diameter be drawn with different filling ...
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 ...
61 views

### Adding a title to TreePlot

This is a basic question I am sure, but cannot seem to find the answer in the documentation. Does anyone know how to add a title to a TreePlot?
138 views

### Color edges of a multigraph when there are parallel edges using Graph[] and EdgeStyle

This a related question to : How can I display a multigraph with different colored edges? However I'm not using GraphPlot. Instead I'm using Graph and EdgeStyle attribute. Take this graph : How can ...
429 views

### Automatically convert pairs of directed edges to an undirected edge?

I have a directed graph, which for some pairs of vertices, has a directed edge between them in each direction. I would like to replace such pairs of directed edges between the same vertices but in ...
36 views

### Error with AppendTo [duplicate]

I am trying to write a function that builds a graph, or - better said - adds a layer of leaves to a pre-existing graph. Basically, I hand to the function three lists. ...
45 views

### Draw a single disconnected vertex [duplicate]

I am just started using Mathematica. I am trying to split my graph into two sets. 1. How does Mathematica split the graph into 2 subgraphs (connected or disconnected)? 2. How can I draw a graph with ...
92 views

### LayeredGraphPlot: how to specify edge endpoints?

What directive within the LayeredGraphPlot command specifies where the edges attach to vertices? For example, instead of the left output below, I'd like to have the right one. ...
77 views

### TransitiveClosureGraph` doesn't return self-loops for nodes that are in a cycle

This is from boost library documentation: The transitive closure of a graph G = (V,E) is a graph G* = (V,E*) such that E* contains an edge (u,v) if and only if G contains a path (of at least ...
390 views

### Using GraphData to generate all directed graphs with n vertices

Using Combinatorica, it was possible to generate unlabeled (non-isomorphic) directed graphs of $|V|=n$. Here the example is for $n=4$: ...
88 views

### Export and Import a list of graphs?

I want to export a list of graphs that come as output to my program. However, I tried exporting all the graphs as graphs using Map and an Export statement with "graph.gml" statement, but got an error. ...
85 views

### Is there a way to combine VertexLabeling->True and VertexLabels/Tooltip in TreePlot?

Basically, I'm trying to make Mathematica give me a tree with names inside the rectangles like so: ...while also having the properties of VertexLabels or Tooltip, which lets me place my mouse over ...
177 views

### Vertex styling in CommunityGraphPlot

Is there a way to change the colours of nodes within one community? Mathematica assigns vertex colours automatically to each community. However, I'd rather like to use my own colour set. ...
336 views

### LayeredGraphPlot Vertex Spacing / Edge Length

For anyone who has used LayeredGraphPlot (Mma v9), you have probably seen that the vertex spacing is consistent throughout, that vertices have the same minimum unit ...
57 views

### How to query W|A, to get a list of asymmetric, bicubic and $3$-edge colorable graphs? [closed]

I'm interested in finding graphs with certain properties, like the smallest cubic bipartite asymmetric graph. While working on a related graph-theoretic problem, concerning edge-colrings, I came along ...
79 views

### Insert an element to AdjacencyGraph

I'm not able to insert an element to mine AdjacencyGraph. I suppose that i should modify my AdjcencyMatrix: ...
60 views

### Purpose of VertexWeight

I am trying to partition a graph into partitions of equal weight (on the vertex). I looked at the documentation, and found VertexWeight, which seems to attach a weight to a vertex. In the details, ...
91 views

### Multi-named Vertices (or Overlapping Vertices) in TreePlot/LayeredGraphPlot, or Merging Trees

If there is a series of rules from which a TreePlot/LayeredGraphPlot is made: ...
361 views

### Graph Coloring based on neighboring vertices? Cellular Automata

I would like to apply a majority rule cellular automata to graphs. Specifically, I would like to take a graph as input, and then define two functions, InitialColoring[graph] and MajorityRule[graph]. ...
543 views

### Label multiple edges between same vertices

I have a simple graph with multiple edges between two vertices, say: Graph[{ Labeled[a -> b, "A"], Labeled[a -> b, "B"] }] Unfortunately, Mathematica ...
106 views

### Change group generators?

I want to make Cayley graphs for the same group, but with different generators. Is there any way to represent a group, besides a cumbersome permutation representation or using the default Mathematica ...
94 views

I have a graph defined as follow: ...
652 views

### How to implement the directed Barabasi-Albert algorithm in Mathematica?

Does anyone know how to implement an efficient version of the [directed Barabasi-Albert algorithm][1] in Mathematica that scales until hundred of thousands nodes? The directed network mechanism is ...
89 views

### How to insert Tooltip into incidence plot?

I'm trying to make a graph using a file .NET extracted from a file .CSV and to make tooltiped the vertices' labels. Initially I ...
292 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 ...
68 views

### AdjacencyList of DirectedEdges in Graph ignore edge direction

I have a simple tree graph with directed edges: In: AdjacencyList[Graph[{a -> b, a -> c, b -> d, b -> e}], b] Out: {a, d, e} I wonder how I can ...
79 views

### Specifying the style of edges in directed graphs [closed]

How do I specify the style of individual edges in a directed graph (in Mathematica version 9)? Consider maybe this ...
153 views

### IsomorphicGraphQ giving an error when the graphs contain multi-edges [duplicate]

If I run IsomorphicGraphQ on the following graphs, I get an error I don't understand: ...
90 views

### Is it possible to use EdgeCapacity in FindMinimumCostFlow?

I'm having trouble getting the EdgeCapacity feature in FindMinimumCostFlow to work. I have attached a simple example. We have a simple graph of four vertices. There are two paths from the "source" ...
254 views

### Using VertexDelete to remove vertices by degree

I am trying to remove vertices that have degree less than 2, but I think I am missing something basic. I was hoping that I could use: ...
51 views

### Export format for graphs loses type information?

I have a situation where I am adding properties to vertices in my graph. In my case, I am adding a moduleId, which is an integer, and a kind, which is a string. I attach a weight to the edge as well. ...
74 views

### FindCycle not working as expected for multigraph

Say I have a simple multigraph like so: edges = {DirectedEdge[a, b], DirectedEdge[b, c], DirectedEdge[c, a]}; g = Graph[Join[edges, edges]] ...
59 views

### Bugs in VertexContract function?

I think there may be two bugs in the VertexContract function: 1) The updated graph does not include reasonable edgeweights 2) The function does not actually reduce the number of vertices in the graph....
76 views

### Finding if a graph contains an even cycle

I am looking for a simple boolean-like function which could check if a graph contains an even cycle. I'm aware there is ExtractCycles but I'm looking for a true/false output than a list of cycles.
407 views

### Is it possible to draw a curved edge between two vertexes of a graph? [duplicate]

The following code generates a graph. ...
231 views

### Intelligent vertex placement in large tree graphs

This question about graph layout is fairly general, but can be illustrated in the case of the Collatz Conjecture. Collatz created the following function over integers greater than 1: If the integer ...
116 views

### How to change the vertex shape

(Using V9 on Ubuntu) Consider the following code, to create a graph. ...
171 views

### (Tree) Graph Layout

I am trying to draw a graph in a tree-like form. I can't use TreeGraph because what I am drawing is not properly a tree (has loops) so TreeGraph won't draw it. Here is the code: ...
117 views

### Normalize centrality measures

How I can normalise centrality measures? Can I use Normalize function? I give example of unnormalized measures ...
106 views

### Overlapping EdgeLabels

I have to make a directed graph for a maximum flow algorithm assignment. Although I have managed to make the graph for the better part, it still needs some work. The problem is that Mathematica ...