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)

11
votes
2answers
744 views

Convert Graph to Graphics

In Mathematica 9, a graph is returned as an object with head Graph: In[1]:= CompleteGraph[8] // Head Out[1]= Graph ...
0
votes
2answers
79 views

How to make a graph form imported spreadsheet data [closed]

I've three csv files: v.csv for vertex data, like this: 1 2 3 ... e.csv for edges: 1,2 2,4 2,24 3,1 ... and vcoor.csv for vertex coordinates: 23.4, 35.2 23.4, 40.3 ... I know how to construct a ...
11
votes
5answers
4k views

How to generate and draw simple bipartite graphs?

A bipartite graph is a graph whose vertices can be divided into two disjoint sets. Given two lists: {1, 2, 3} and {x, y, z}, ...
3
votes
3answers
87 views

Random bipartite graphs?

RandomGraph[{n,m}] generates a random graph with $n$ vertices and $m$ edges. I want to generate a random bipartite graph, like ...
7
votes
3answers
324 views

Test if directed graph is connected

Is there a simple built-in way to check if a directed graph is connected? Now, before you throw ConnectedGraphQ or ...
8
votes
3answers
228 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 ...
2
votes
1answer
65 views

VertexLabels with Graph Properties

Suppose I have a graph like this Graph[ {1 <-> 2, 2 <-> 3, Labeled[3 <-> 1, "hello"]}, VertexLabels -> Placed["Name",StatusArea] ] Now ...
3
votes
3answers
299 views
3
votes
1answer
374 views

How to convert a sparse array to a graph?

s = Import["hello.mat"]; t = GraphEmbedding[Graph[s[[1]]], "GridEmbedding"]; I get the following error: GraphEmbedding::graph: A graph object is expected ...
0
votes
1answer
59 views

How can I code a graph visibility criterion using an If-statement?

The visibility criterion can be defined as follows: two arbitrary data values $(ta , ya)$ and $(tb , yb)$ are visible to each other if any other data $(tc, yc)$ placed between them fulfills the ...
14
votes
1answer
146 views

Question about TransitiveReductionGraph

Bug introduced in 10.0 and persisting through 10.4 Note: TransitiveReductionGraph is new in 10.0. In Mathematica 10.0 and 10.1, according to the documentation ...
10
votes
1answer
89 views

Arrows from GraphicsComplex not converted to Normal form correctly

Bug introduced in 7.0 or earlier and persisting through 10.4.0 Show @ Graph[{1 -> 2, 2 -> 3}, Frame -> True] Normal @ % Is this a pure bug, or have ...
14
votes
1answer
156 views

IsomorphicGraphQ fails to recognize that two empty graphs are identical

Bug introduced in 9.0.1 or earlier and persisting through 10.4.0 Consider the following two graphs: ...
8
votes
0answers
111 views

Deleting zero edges from a graph causes bizarre behavior

Bug introduced in 10.3.0 and fixed in 10.4. Consider the following (very simple) graph, with two vertices and one edge: g = Graph[{1, 2}, {1 <-> 2}]; ...
2
votes
1answer
40 views

Certainty of the New Vertex Name after using EdgeContract

It appears that when I use EdgeContract on an undirected graph, the vertex that is the result of contracting an edge is always named the smaller of the two ...
4
votes
2answers
189 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: ...
3
votes
1answer
18 views

Why does Mathematica report the VertexEccentricity of a disconnected vertex as zero?

"For a disconnected graph, all vertices are defined to have infinite eccentricity" So, why does Mathematica report the VertexEccentricity of a disconnected vertex as 0 instead of ...
1
vote
1answer
23 views

VertexContract, VertexReplace and non-anonymous collapsed node

Can the standard VertexContract or VertexReplace functions display a name for the collapsed node ? Here is a minimal example: ...
2
votes
1answer
51 views

Trying to remove duplicate isomorphic graphs in a list of graphs [duplicate]

I am working on a Mathematica program that involves taking a graph and generating all of its single-edge contractions. When I get this list of contractions, it often happens that many of the graphs ...
3
votes
1answer
62 views

How can I get the arguments of the function Graph?

If I have f0 = f[x,y,z] and I am interested in the list of the arguments, what I do is ...
8
votes
1answer
138 views

Petrie polygon projection of a hypercube graph

I am trying to generate the Petrie polygon projection of the 8-cube in Mathematica, like this one: I tried using, for example, the HypercubeGraph function: ...
11
votes
2answers
247 views

Vertex descendants subgraph

Keywords: vertex, ancestors, descendants, subgraph, directed graph, flow subtree So let's say we have a TreeGraph: ...
0
votes
0answers
14 views

Acyclic Directed Graph, NeighborhoodGraph and ancestors [duplicate]

What is the correct way of find the list of a given vertex' ancestors in an ADG ? I am thinking that a pattern in NeighborhoodGraph might be the solution or a negative option for the degree of ...
4
votes
1answer
279 views

Graphs in 3 dimensions

I have a desired graph as here: the dashed line is just for perspective representation. I tried with LayeredGraphPlot and ...
3
votes
1answer
62 views

Find independent vertex sets

I'm trying to find all independent vertex sets for a given graph. Note that they may not be maximal independent sets. There is a function in Mathematica called ...
8
votes
2answers
237 views

Plot a 3-cycle graph with clockwise-directed edges

When I try to plot a 3-cycle, the edge direction is always counter-clockwise. The plotting code is ...
6
votes
2answers
107 views

Small World network on a square grid

My aim is to generate a 2D Small World network on a square grid. i.e. 20x20. With a probability of 5%, one node rewires from an adjacent node to a random node of the grid, allowing some long distance ...
2
votes
0answers
112 views

How to make a flowchart? [closed]

I'd like to make a flow chart in similar to this: I think it's more of a layout and stylistic question for a graph - how to style a graph with labeled edges and vertices so that it looks like a ...
1
vote
1answer
44 views

Trying to get simple excel data to be imported as a social network directed graph

My data has two columns that we'll call A and B. The columns proceed as such A B A1 B1 A2 B2 A3 B3 .... I'm trying to make this into a directed graph where A1 has an outgoing edge to B1 and ...
4
votes
3answers
162 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 ...
0
votes
2answers
198 views

Using different colors in TreeForm?

I've used TreeForm, and I appreciate that the syntax is fairly short, especially in comparison with TreeGraph. Is it possible ...
7
votes
1answer
115 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,...
2
votes
2answers
91 views

Is it possible to visually edit a graph?

Given a graph, obtained by something like CompleteGraph[5], can I somehow add/remove edges/vertices visually? Or is the only alternative to transform it via ...
2
votes
2answers
98 views

VertexDelete Problem

I am doing a straightforward deletion of a set of vertices in a Tree using Mathematica. ...
4
votes
2answers
114 views
5
votes
0answers
49 views

What's meaning of `VertexConnectivity`?

Are there a conflict in this two place in documentation? In the Basic Examples: Then the Properties & Relations But actually:
0
votes
0answers
66 views

Plotting a graph on a torus and another surfaces [duplicate]

I'm trying to figure out how to plot a graph on a surface. My goal is to represent a planar embedding of $ K_5$ in a torus. I have encountered this post, where you can find an explanation how to plot ...
14
votes
1answer
303 views

GeoGraphics : path within a country

I am using GeoGraphics to visualize electricity distribution networks in certain countries. I have susbtation location data, as well as network incidence matrices ...
5
votes
0answers
80 views

Issues adding properties to multigraph

Unsupported Functionality (loosely, a bug) Mathematica (as of 10.3) does not support multi-graph where edge properties vary between two nodes that share multiple edges. Although this is not ...
2
votes
1answer
60 views

Generate list of traceable and planar graphs

Is there any way to tell Mathematica to generate a list of graphs that are both traceable and planar?
14
votes
2answers
287 views

Zoom in on a 2D graph

I have seen many queries on zooming in on plots etc. But I haven't seen any regarding 2D graphs. For eg if I have a graph like Graph[{1->2, 2->3, 3->1}]. ...
3
votes
1answer
140 views

Hasse Diagrams from Adjacency Matrix

Let's say I have a rather large adjacency matrix for a partial order relation. Say an 80x80 matrix. What is the best way to display Hasse diagram? I have tried AdjacencyGraph and it does a not so bad ...
14
votes
1answer
534 views

Dual graph of an arbitrary (planar) graph

Every planar graph has a dual. How can I obtain it with Mathematica? I know that GraphData provides the DualGraph property for ...
12
votes
1answer
257 views
1
vote
0answers
52 views

Is there a way to update a graph in place?

I'm assembling graphs programmatically, and looping through EdgeAdd[] a lot. graph = EdgeAdd[graph, a -> b]; Is there a more efficient way to do the updates ...
9
votes
0answers
93 views

Set new edge capacity

Bug introduced in 9.0 or earlier and persisting through 10.3.1 I am trying to add a new edge to an existing graph and set its capacity, but for some reason the ...
11
votes
2answers
122 views

EdgeAdd function not adding edges to a RandomGraph[ ]

Bug introduced in 9.0 or earlier and persisting through 10.3.1 I have a graph: g = RandomGraph[{1, 0}] So basically, it is just one vertex. I want to add some ...
2
votes
2answers
70 views

DiscreteMarkovProcess: labelling of states

Related, but it seems like the respondents there misunderstood the question. The following errors as DiscreteMarkovProcess::invsm: ...