An 'all encompassing' formal definition of 'graph' I've not been able to find a formal definition of graph that's  all encompassing.
By  all encompassing,  I mean a formal definition of graph that's so general, that each of the various types of graph one usually encounters in the literature (for example: directed graphs, multigraphs, graphs with loops, etc.) is just a special case of that general definition.
Does anyone know of such an  all encompassing  formal definition of graph?
If not, if someone has come across (or thought of) a formal definition of graph that's almost  all encompassing,  I would be very interested to hear of it.
I feel that many of us with an interest in graph theory would consider an  all encompassing  (or very generalized)  formal definition of graph to be potentially useful.
I hope someone can provide us with such a definition!
 A: Sure, here goes:
A graph is a triple $(V,E,f)$ where $V$ is a set (the vertices of the graph),
$E$ is a set (the edges of the graph), and $f \colon E \to V^{<\omega}$ is a function assigning to each edge its set of vertices, where $V^{<\omega}$ means the set of all tuples (finite sequences) from $V$.
This is general enough to include hypergraphs, directed graphs, and multigraphs. Graphs with various labelings or colorings (e.g. voltage graphs) just add some more functions from $V$ or $E$ to some set.
In the case of any graph which isn't a hypergraph, $f$ will map into $V \times V \subset V^{<\omega}$. For a non-directed graph, the order of the entries in the ordered pair $f(e)$ for each edge $e$ will be ignored. For a simple graph, $f$ is required to be injective and to avoid the subset $\Delta V = \{ (v,v) \mid v \in V \} \subset V \times V$.

To be able to distinguish undirected edges from directed edges without some prior knowledge of how the graph is to be interpreted, we change the definition so that $f: E \to V^{<\omega} \cup 2^V$ is a function into the set of all tuples from $V$ and all subsets of $V$. Edges which map to tuples are directed; edges which map to subsets are not directed.
So: an undirected loop $e$ maps to a singleton set $\{v\}$; a directed loop maps to the ordered pair $(v, v)$; a "semi-edge" maps to the 1-tuple $(v)$.
