Neo4j - Graph Theory Basics



A Graph is a set of nodes and the relationships that connect those nodes. Graphs stores data in Nodes and Relationships in the form of Properties. Properties are key-value pairs to represent data.

In Graph Theory, we can represent a node with a circle and relationship between nodes is represented with an arrow mark.

The simplest possible graph is a single Node.

Neo4j CQL Tutorial

We can represent a Social Network like Google+(GooglePlus) profile with a Node. It does NOT contain any properties.

Add some properties to Google+ Profile

Neo4j CQL Tutorial

This node contains a set of properties. A Property is a name:value pair.

Relationships are created between two nodes

Neo4j CQL Tutorial

Here Relationship name "Follows" is created between two profiles. That means Profile-I follows Profile-II.

Complex Graph Example

Neo4j CQL Tutorial

Here nodes are connected with relationships. Relationships are unidirectional or bi-directional.

  • Relationship from XYZ to PQR is a unidirectional relationship.
  • Relationship from ABC to XYZ is a bidirectional relationship.

Advertisements