My C++ realization of graps as discrete mathematics task.
A class in C ++ that describes a graph / digraph. The class support the following functionality: • determination of the number of vertices; • determination of the number of edges (arcs); • determination of the degree of an arbitrary vertex (for a digraph - half-degrees of outcome and approach); • determination of the power sequence of the graph; • definition of an adjacency matrix; • definition of the incidence matrix; • definition of adjacency list; • determination of hanging vertices, determination of isolated vertices; • definition in a digraph of sources and sinks; • determination of the distance between two peaks; • determination of the eccentricity of the peak; • determination of the diameter of the graph; • determination of the radius of the graph; • determination of the center of the graph; • definition of peripheral peaks; • adding / removing vertices to the graph; • adding / removing edges to the graph; • definition of addition to the graph; • subdivision of the rib; • contraction of the graph; • identification of vertices; • duplication of the top; • breeding peaks; • union (disjunctive) graphs; • connection of graphs; • product of graphs; • input / output of graphs into a text file as an adjacency list in the following format: {1 ...} {2 <adjacent vertices through a space} ... For example: {1 2} {2 1 4} {3} { 4 2}.
The main program demonstrate the capabilities of the developed class. • it allow the user to specify a graph in any of three types (adjacency list, adjacency matrix or incidence matrix) and receive any other representation at the output; • at the user's request, display the characteristics of the graph (number of vertices, number of edges, power sequence, degree of the selected vertex); • allow the user to perform operations implemented in the class;