In-degree and out-degree for each associated relationship type for Neo4j database node
Search Node Degree for Node
Create a Neo4j® database connection using the URL
http://localhost:7474/db/data, user name
neo4j, and password
url = 'http://localhost:7474/db/data'; username = 'neo4j'; password = 'matlab'; neo4jconn = neo4j(url,username,password);
Message property of the Neo4j® connection object
neo4jconn. The blank
Message property indicates a successful connection.
ans = 
Search the database for the node with node identifier
2 using the Neo4j® database connection
nodeid = 2; node = searchNodeByID(neo4jconn,nodeid);
Search for the degree of all incoming relationships for the node.
degree returns a structure with the in-degree for each relationship type.
degree = nodeDegree(node,'in')
degree = struct with fields: knows: 1
Close the database connection.
degree — In- or out-degree
In- or out-degree, returned as a structure. Each field in the structure represents either incoming or outgoing relationship types. If there are no incoming or outgoing relationship types, the structure is empty.
Introduced in R2016b