Graphs are mathematical structures consisting of nodes connected by edges, used to model pairwise relations between objects.A graph is a mathematical structure consisting of vertices and the edges connecting them. Unlike a geographical map, what matters here is not the shape of the lines but the presence of a connection and, possibly, its weight (for example, road length or travel time). This abstraction allows applying the same search algorithms to social networks, traffic flows, and even chemical reaction chains.
The birth of graph theory is linked to Leonhard Euler's work 'The solution of a problem relating to the geometry of position' (1736), where he demonstrated the impossibility of traversing all seven bridges of Königsberg without crossing one twice. The term 'graph' was introduced by K. König in 1936. In the 20th century, graph theory flourished thanks to problems in discrete optimization and computer science.
Graphs model systems of pairwise interactions. Analysis relies on adjacency and incidence matrices. Graph properties are studied through invariants: connectivity, cyclomatic number, chromatic number. Efficient algorithms on graphs (shortest path, maximum flow) are based on dynamic programming and greedy strategies. In physics, graphs are used in diagrammatic techniques (Feynman diagrams are directed graphs) and in the study of random media.
Graphs help find the shortest path in a navigator and recommend new friends on social networks.
In Facebook's social graph, the average distance between any two users is only 3.5 steps—this is the 'six degrees of separation' theory in practice.
| w_1 | variable | weight for a — weight |
| a | variable | first value |
| w_2 | variable | weight for b — weight |
| b | variable | second value |





















