A couple of updates more:
1. support for networks (commands: is_network, random_network_graph, maxflow)
2. improved highlight_subgraph command, now it supports overwriting edge weights with those in the subgraph which is useful when highlighting optimal flows
3. added is_cut_set command
Here's the short help for the new commands:
Code : Tout sélectionner
# is_network
0 G,[s,t]
2 Returns true if the graph G is a network with the source s and sink t, else returns false. If s,t are not given, the output is a sequence of two sets of vertices: sources and sinks.
-1 random_network
-2 maxflow
is_network(digraph(trail(1,2,3,4,5,6,4,7)))
is_network(digraph(trail(1,2,3,4,5,6,4,7)),1,7)
is_network(digraph(trail(1,2,3,4,5,6,4,1)))
Code : Tout sélectionner
# random_network
0 a,b,[p],[opts]
2 Returns a random network graph with b grid frames of size a*a in which every edge appears with the probability p (by default 0.5).
-1 is_network
-2 maxflow
random_network(3,3)
random_network(3,3,acyclic)
random_network(3,4,0.75)
Code : Tout sélectionner
# maxflow
0 G,s,t,[M]
2 Returns the optimal value for the max flow problem for network G with the source s and sink t (an optimal flow is written to M as a matrix).
-1 is_network
-2 random_network
maxflow(digraph(%{[[1,2],2],[[2,3],4],[[3,4],3],[[1,5],3],[[5,2],1],[[5,4],2]%}),1,4)
Code : Tout sélectionner
# is_cut_set
0 G,E
2 Returns true if removing the edges in E from the graph G increases the number of connected components of G, else returns false.
-1 connected_components
-2 delete_edge
is_cut_set(graph(trail(1,2,3,4,5,6,4,1,3)),[[1,4],[3,4]])
Also, the following changes are required to support new option "acyclic":
1. Add the following line below line 595 (at the end of the maple_conversion enum) in dispatch.h:
2. Add the line
Code : Tout sélectionner
{"acyclic", 0, _GT_ACYCLIC, _INT_MAPLECONVERSION, T_TYPE_ID},
after the line 71 in lexer_tab_int.h.
Short help for the option:
Code : Tout sélectionner
# acyclic
0 Opt
2 Option for the random_network_graph command.
-1 random_network_graph
Edit: changed random_network_graph to random_network