Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

relation-tail-merging-1.0 #9

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Conversation

MaxLegnar
Copy link
Collaborator

@MaxLegnar MaxLegnar commented Aug 22, 2024

Hi,

I added a new method to convert a multi-relational rdf-graph file into a non-relational graph of type datastructures::Graph, called "relation-tail merging".
It can be used by calling the datastructures::Graph::rdflib_to_graph() method with the new input-parameter relation_tail_merging=True.

The process of relation-tail merging tries to solve the issue that predicate-nodes often carry little to no information (which is why these candidates are usually skipped during walk mining).
Relation_tail_merging works as follows (is also explained in our corresponding paper, which is currently under review):

First, the next tail node is selected, t, as well as a set of nr relations of identical type, r, where the topological form ()-r->(t) is given. The process of relation-tail merging then involves inserting a new node, rt, so that ()-r->(t) turns into (*)-->(rt)-->(t). The new directional edges, -->, are now typeless, and the new inserted node, rt, represents a "relation-modified" node and is named accordingly in the form <type_of_r>_<name_of_t>.

To implement this method, i changed the datastructures::Graph::rdflib_to_graph() method accordingly and i also applied a small change to the function MINDWALCMixin::_generate_candidates(), so that, if we use a relation-tail merged graph, MINDWALC does also collect walks with odd depths, so that also (rt) nodes are considered during candidate collection.

I also added a mew function to the datastructures::Graph class, called graph_to_neo4j(). This method can load a given datastructures::Graph instance into a running and empty neo4j database. This can be useful to investigate our graph using the neo4j desktop app.

MaxLegnar added 6 commits July 2, 2024 11:23
…_tail_merging: bool)

The relation_tail_merging mode applied the relation-tail merging method, as introduces in our new paper.
…is very useful for exploring and debugging our processed graph)
…skip_literals: bool).

If True, literals (=node properties/attributes) are skipped during the conversion.
Otherwise, they are converted to nodes. so that a node (n: {name: 'John'}) becomes (n)-->(name)-->(john).
…rate_candidates(): during walk candidate collection, only even walking depths (2, 4, 6...) where collected. But if we process an relation-tail merged graph, we also need to consider odd walking depths!
@MaxLegnar
Copy link
Collaborator Author

Short update:

Just a friendly reminder to process this pull request.
The corresponding paper is currently in the second revision and might be published soon.

I think the made changes of this branch are save to merge, because i made some tests with relation-tail merging (rtm) and without.
And the results without rtm seems to be quite close to the results archived in the original MINDWALC paper:

image

As we can see, MUTAG seems to benefit from rtm, the other datasets not that much...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant