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)

3
votes
0answers
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 ...
3
votes
1answer
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: ...
1
vote
1answer
32 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 ...
11
votes
2answers
252 views

Vertex descendants subgraph

Keywords: vertex, ancestors, descendants, subgraph, directed graph, flow subtree So let's say we have a TreeGraph: ...
1
vote
1answer
34 views

Scan appears to work setting graph properties, but get error on property-read

This is a self-contained version of something a bit bigger - going for brevity. It is a bit synthetic, but there are applications I have in mind where the {{1,2}} will be replaced with real data, more ...
2
votes
1answer
50 views

Path with no dependence violations

I am guessing this will be a duplicate(it seems like a common task), but I obviously can't find the right page. I have a directed graph showing dependencies, and I want to list the vertices in an ...
5
votes
0answers
83 views
2
votes
2answers
159 views

How to find all possible paths with as many edges between two same vertices?

Suppose I have an undirected graph G = Graph[{1 <-> 2, 2 <-> 3, 2 <-> 3, 3 <-> 4}] I used ...
6
votes
2answers
219 views

Extract bibliography from a PDF document

I am trying to extract bibliographies from academic papers which are in pdf format, and I have to do this for 100+ papers. My goal is to create a network of citations amongst the authors and identify ...
6
votes
2answers
163 views

Grouping the list of numbers that have common.

I am working on some simple problem. It is like puzzle.. Let's say I have some list input={{1,1},{1,2},{1,3},{2,3},{3,3},{4,4}} Which means 1 can go and back to ...
4
votes
2answers
191 views

Ploting a parallel graph for an animation

I am sorry that my attempt to obtain a fully functional plot as I want failed badly because I am not able to integrate the features to the graph. Here is my simple code: ...
8
votes
1answer
82 views

Is there an easy way to set or retrieve a graph edge properties as a list, in a single go?

I am trying to use arbitrary edge properties in Graphs, and I am looking for easy ways to work with them. In many cases it would be convenient to be able to set ...
0
votes
1answer
73 views

Creating confidence interval plots for random graphs

I have the following code where I create instances of random graphs and use their properties to compute the mean of a quantity labeled 'PoA'. In the last line, I use a range of values for the ...
4
votes
1answer
84 views

How to use the “EdgeLayout” suboption of GraphLayout?

According to the documentation, GraphLayout has an EdgeBundling suboption, which can take the following values: ...
1
vote
0answers
52 views

Graph equivalent of GraphPlot's MultiEdge style?

I like the default display of Graph much better than that of GraphPlot, but I do not see how to turn off the use of multi-edges ...
8
votes
3answers
253 views

How to count all cliques (not just maximal ones) in graphs?

How can I count the numbers of $r$-cliques in a graph? In other words, the number of triangles, the number of $K_4$, the number of $K_5$ etc. I have tried for example ...
4
votes
1answer
173 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, ...
1
vote
1answer
70 views

LayeredGraphPlot how to change color of vertex box

For LayeredGraphPlot how to change the default yellow color? ...
2
votes
0answers
83 views

How do I get all possible paths in terms of edges, and not vertices in Mathematica?

Suppose I have an undirected graph ...
0
votes
3answers
118 views

How to Change Vertex List in a Grid Graph

I would like to actually change the vertices in a grid graph instead of simply changing the label. Ultimately, I want the vertices to be points on a plane. So if given a simple grid graph ...
2
votes
1answer
58 views

How to draw vertices with identical names multiple times?

I have a list of rules that I would like to show as a layered graph. However, some vertex names appear more than once. How would one best deal with this situation? Example: ...
4
votes
1answer
94 views

Is there a way to efficiently generate a large “incomplete” k-partite graphs

A complete k-Partite graph can be divided into "k" distinct sets of nodes, each of which is connected to all nodes not in its own set. This can be generated with code CompleteGraph[{an, bn, cn}] ...
5
votes
0answers
130 views

Number of 4-colorings of Johnson solids

I want to know the number of 4-colorings for all Johnson solids. This is equivalent to evaluating the flow polynomial for the corresponding polyhedral graphs at $k=4$. I tried the following to get ...
0
votes
3answers
100 views

Weighted and directed network computation in Mathematica

Is there any set of commands in Mathematica to compute mean shortest path, global clustering coefficient, diameter and radius of the network, etc. for weighted and/or directed graphs? There indeed ...
11
votes
1answer
139 views

How can I route edges manually for a Graph?

Most graph layouts supported by Mathematica use straight lines for edges; or at least something that only depends on the coordinates of the two adjacent vertices of the edge and nothing else. A ...
0
votes
1answer
192 views

Network/Graph Visualization read edgelist

I have what it seems to be a very trivial question, but after searching for hours I was not able to find an answer, so I am asking here. I have an edgelist for a graph, a 2 column csv file with id1,...
17
votes
1answer
490 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.
8
votes
0answers
89 views

More efficient way to generate lattice graph with edges between visible vertices?

Given a nXn lattice, I need to generate the graph such that there is an edge between two vertices iff they are directly "visible" to each other, i.e., there is no vertex between them. I'm using <...
2
votes
1answer
51 views

Converting from GraphData to graph object

I know this is a simple question, but suppose I have a graph G = Part[GraphData[n],i] How do I convert this into a graph object accepted by ...
1
vote
1answer
93 views

Lack of arrows in Markov Chain graphs

I'm following this: http://www.wolfram.com/mathematica/new-in-9/markov-chains-and-queues/structural-properties-of-finite-markov-processes.html When I try to graph the Markov chain with Graph[proc] I ...
1
vote
2answers
68 views

How do I import a non-directed graph in graphml format?

I have created a graph with undirected edges, and I'm trying to import it into Mathematica. However, when I import it, I get directed edges. ...
2
votes
1answer
50 views

Increasing the font size in the Vertexlabels of GraphPlot

I have the following code and corresponding output: GraphPlot[Table[i -> Mod[3^i, 5], {i, 20}], VertexLabeling -> True] I wish to do two things: 1) ...
1
vote
1answer
35 views

Display options for GraphData output [duplicate]

How can the display of graphs using GraphData be customized? For example, how can we customize the vertex style, color, edge thickness of the output to...
9
votes
1answer
74 views

Cannot set VertexCoordinates twice in a Graph. Workaround?

Versions 10.0-10.2 seem to have a bug when trying to set VertexCoordinates twice on a graph (version 9.0 is fine). Can you confirm it? What is a good workaround ...
5
votes
1answer
235 views

Adjacency matrix from image file of plane map

I have image files (PNG format) of plane maps of regions delimited by black borders I would like Mathematica to compute the associated adjacency matrix for the contiguous regions in these maps. ...
0
votes
0answers
63 views

adjacency matrix with directed graph connected nodes

I was trying to plot a 9x9 adjacency matrices which produce a useless directed graph. Codes for that I used: ...
0
votes
0answers
107 views

ViewVector requires click before behaving with Graph3D (Also, viewing 3D subgraph “head on.”)

I want to produce 3D subgraphs that looks "head on" at the remaining vertices, held in their original positions via VertexCoordinates. The default viewpoint is not ...
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 ...
3
votes
1answer
102 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
109 views

GraphDistance gives incorrect result in weighted multigraph [closed]

Bug introduced in 10.0 and persisting through 10.3 Multigraph support was introduced in 10.0 There are bugs in Graph on Mathematica 10.1. For example, ...
5
votes
2answers
153 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
213 views

Vertex Order of Graph

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

Issues adding properties to multigraph

Unsupported Functionality (loosely, a bug) Mathematica (as of 10.4.1) does not support multi-graph where edge properties vary between two nodes that share multiple edges. Although this is not ...
3
votes
2answers
87 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
61 views

Unexpected AdjacencyMatrix output [duplicate]

I have a directed graph with this Edgelist defined as follow: ...
2
votes
2answers
83 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
134 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
79 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 <...
6
votes
1answer
241 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 ...