Julius Hamilton
Julius Hamilton
ATApache TinkerPop
Created by Julius Hamilton on 10/17/2024 in #questions
What algorithms exist for this hypergraph data structure?
This is very minimal, but it hints at a type of ontology structure and software system I want to develop. Does it remind you of any known, studied data structures and algorithms?
ontology = set()

def add(s):
ontology.add(s)

def show():
for item in ontology:
print(item)

def link(s1, s2):
# Python requires you add hashable objects to sets to determine duplicates; sets aren’t hashable because mutable, apparently
ontology.add(frozenset([s1, s2]))

def delete(s):
ontology.discard(s)
ontology = set()

def add(s):
ontology.add(s)

def show():
for item in ontology:
print(item)

def link(s1, s2):
# Python requires you add hashable objects to sets to determine duplicates; sets aren’t hashable because mutable, apparently
ontology.add(frozenset([s1, s2]))

def delete(s):
ontology.discard(s)
The key thing is this allows reification. You can add two things, link them, and that linked unit acts as a thing. You can link it to other things. Every link is a hyperedge. Every hyperedge is a node. It’s basically a subset of a set of elements closed under pairing. One would want to develop more useful algorithms, at this point. For starters: - An algorithm that checks that every element in every linked pair is present in the set. - An algorithm that finds all the elements linked with the same element. - An algorithm that combines every element linked to an element into a single element linked to that element. The latter is partially a way to establish “definitions as extensions”: if we associate “animal” with “duck”, “animal” with “lion”, etc., we can merge all the animals into a single set of animals, and link it to the word “animal”. Do you recognize this exact structure? Know any papers on it?
2 replies
ATApache TinkerPop
Created by Julius Hamilton on 9/30/2024 in #questions
Good CLI REPL allowing unlabeled edges?
Is there another tool like Gremlin with a REPL but perhaps overall simpler? I’m mainly looking for the ability to make labeled nodes and unlabeled directed binary edges (arrows) between nodes. (On the other hand, I can use a generic label for every level in my Gremlin graph, I guess.)
4 replies
ATApache TinkerPop
Created by Julius Hamilton on 9/24/2024 in #questions
Why is T.label immutable and do we have to create a new node to change a label?
We cannot do g.V('some label').property(T.label, 'new label').iterate() ? Is this correct? Thank you
20 replies
ATApache TinkerPop
Created by Julius Hamilton on 9/22/2024 in #questions
Simple question about printing vertex labels
I am creating a graph in the gremlin cli by doing graph = TinkerGraph.open(), g = graph.traversal(), g.addV("somelabel"). i can confirm a vertex was created. i can do g.V().valueMap(true) and it shows ==>[id:0,label:documents]. But I so far do not know how to print information about a vertex via its index. I have tried g.V(0) but it doesnt print anything.
5 replies
ATApache TinkerPop
Created by Julius Hamilton on 9/20/2024 in #questions
Defining Hypergraphs
I want to create a software system where a person can create labeled nodes, and then define labeled edges between the nodes. However, edges also count as nodes, which means you can have edges between edges and edges, edges and nodes, edges-between-edges-and-nodes and edges-between-nodes-and-nodes, and so on. This type of hypergraph is described well here in this Wikipedia article:
One possible generalization of a hypergraph is to allow edges to point at other edges. There are two variations of this generalization. In one, the edges consist not only of a set of vertices, but may also contain subsets of vertices, subsets of subsets of vertices and so on ad infinitum. In essence, every edge is just an internal node of a tree or directed acyclic graph, and vertices are the leaf nodes. A hypergraph is then just a collection of trees with common, shared nodes (that is, a given internal node or leaf may occur in several different trees). Conversely, every collection of trees can be understood as this generalized hypergraph.
https://en.m.wikipedia.org/wiki/Hypergraph I have been wondering about a good way to represent this data in a data structure.
6 replies