converts a graph to a simple undirected graph
g1 = graph_simp(g)
graph data structure of the new graph
graph_simp
returns the simple undirected graph g1
corresponding to
multigraph g
. It deletes loops in g
, replaces directed edges
with undirected edges and replaces multiple edges with single edges.A simple graph is also called a strict graph.
ta=[1 1 1 2 2 2 3 4 4 4 5 5 6 7 7 8 8 9 9 10 10 10 10 10 11 12 12 13 13 13 14 15 16 16 17 17]; he=[1 2 10 3 5 7 4 2 9 9 4 6 6 8 2 6 9 7 4 7 11 13 13 15 12 11 13 9 10 14 11 16 1 17 14 15]; g=make_graph('foo',1,17,ta,he); g('node_x')=[283 163 63 98 164 162 273 235 267 384 504 493 409 573 601 627 642]; g('node_y')=[ 59 133 223 311 227 299 221 288 384 141 209 299 398 383 187 121 301]; g = add_node_data(g,'elevation',ones(1,17)); g = add_edge_data(g,'diameter',ones(size(ta,1),size(ta,2))); show_graph(g); g1=graph_simp(g); show_graph(g1,'new'); // Because graph_simp doesn't remove nodes, the data at the nodes are kept g.nodes.data g1.nodes.data // graph_simp performs simplifications on the edges. So, the data contained in // g at the edges are lost in g1 g.edges.data g1.edges.data | ![]() | ![]() |
Bronshtein, I. N. and Semendyayev, K. A. Handbook of Mathematics, 4th ed. New York: Springer-Verlag, 2004.
Gibbons, A. Algorithmic Graph Theory. Cambridge, England: Cambridge University Press, 1985.
Harary, F. "The Number of Linear, Directed, Rooted, and Connected Graphs." Trans. Amer. Math. Soc. 78, 445-463, 1955.
Harary, F. "Enumeration of Graphs." In Graph Theory. Reading, MA: Addison-Wesley, pp. 185-187, 1994.
Steinbach, P. Field Guide to Simple Graphs. Albuquerque, NM: Design Lab, 1990.
Tutte, W. T. Graph Theory as I Have Known It. Oxford, England: Oxford University Press, 1998.
West, D. B. Introduction to Graph Theory, 2nd ed. Englewood Cliffs, NJ: Prentice-Hall, 2000.