Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to choose between Links and Edges to connect vertices?

Tags:

orientdb

In orientDB, we have links and edges to connect vertices. I can't find out what the cons/pros of each of them on the orientdb documentation.

Forum Example - three entities involved: Author, Message, Forum.

An author writes a message in a forum. - Option one: message is an edge between Author and Forum vertices - Option two: Message has a link to Author and another link to Forum

In other words, what strategy to choose and why?

like image 900
Y k Avatar asked Nov 16 '15 22:11

Y k


People also ask

How do you find the edges of a vertex?

The sum of the vertex degree values is twice the number of edges, because each of the edges has been counted from both ends. In your case 6 vertices of degree 4 mean there are (6×4)/2=12 edges.

How do you find the number of edges of a complete graph?

A complete graph has an edge between any two vertices. You can get an edge by picking any two vertices. So if there are n vertices, there are n choose 2 = (n2)=n(n−1)/2 edges.

How many vertices does a 5 regular graph with 20 edges have?

A graph with 20 edges has 5 vertices of degree 5 with the rest of degree 4.


2 Answers

Edges are all about connecting vertices. Links are all about relations between other classes.

Two classes may not be associated at all, like a class Oceans and a class Person. But you can have their vertices associated by an Edge named Sailed that may have a property named withShipName`.

So you made a Person vertex called Jack Sparrow, and a Ocean vertex named Atlantic. Then you create an their edge relationship sailed which you can connect like:

Jack Sparrow sailed.withShipName= Black Pearl the Atlantic.

But if you have another Person vertex, like Red riding hood, you don't want to have a link in their vertex properties relating her with an Ocean class.

However, you may want to have a linklist or linkmap linking the class Ocean with class OpticalActiveWaterConstituents, that have vertices to Chorophyll, Suspended Particles, Coloured Dissolved Organic Matter, etc... that are available in all Oceans with different concentrations.

You can refer to this post for the differences between Edges vs LinkList vs Linkmap.

Hope this help to clarify the subject ;)

like image 146
Jobel Avatar answered Sep 29 '22 20:09

Jobel


If you don't have properties on your arch you can use a link, instead if you have it use edges.

like image 21
Michela Bonizzi Avatar answered Sep 29 '22 18:09

Michela Bonizzi