Changeset View
Changeset View
Standalone View
Standalone View
java/server/src/main/java/org/softwareheritage/graph/Graph.java
package org.softwareheritage.graph; | package org.softwareheritage.graph; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
import it.unimi.dsi.big.webgraph.BVGraph; | import it.unimi.dsi.big.webgraph.BVGraph; | ||||
import it.unimi.dsi.big.webgraph.LazyLongIterator; | import it.unimi.dsi.big.webgraph.LazyLongIterator; | ||||
import org.softwareheritage.graph.Node; | import org.softwareheritage.graph.Node; | ||||
import org.softwareheritage.graph.SwhId; | import org.softwareheritage.graph.SwhPID; | ||||
import org.softwareheritage.graph.backend.NodeIdMap; | import org.softwareheritage.graph.backend.NodeIdMap; | ||||
import org.softwareheritage.graph.backend.NodeTypesMap; | import org.softwareheritage.graph.backend.NodeTypesMap; | ||||
/** | /** | ||||
* Main class storing the compressed graph and node id mappings. | * Main class storing the compressed graph and node id mappings. | ||||
* <p> | * <p> | ||||
* The compressed graph is stored using the <a href="http://webgraph.di.unimi.it/">WebGraph</a> | * The compressed graph is stored using the <a href="http://webgraph.di.unimi.it/">WebGraph</a> | ||||
* ecosystem. Additional mappings are necessary because Software Heritage uses string based <a | * ecosystem. Additional mappings are necessary because Software Heritage uses string based <a | ||||
▲ Show 20 Lines • Show All 56 Lines • ▼ Show 20 Lines | public class Graph { | ||||
* | * | ||||
* @return graph full path | * @return graph full path | ||||
*/ | */ | ||||
public String getPath() { | public String getPath() { | ||||
return path; | return path; | ||||
} | } | ||||
/** | /** | ||||
* Converts {@link SwhId} node to long. | * Converts {@link SwhPID} node to long. | ||||
* | * | ||||
* @param swhId node specified as a {@link SwhId} | * @param swhPID node specified as a {@link SwhPID} | ||||
* @return internal long node id | * @return internal long node id | ||||
* @see org.softwareheritage.graph.SwhId | * @see org.softwareheritage.graph.SwhPID | ||||
*/ | */ | ||||
public long getNodeId(SwhId swhId) { | public long getNodeId(SwhPID swhPID) { | ||||
return nodeIdMap.getNodeId(swhId); | return nodeIdMap.getNodeId(swhPID); | ||||
} | } | ||||
/** | /** | ||||
* Converts long id node to {@link SwhId}. | * Converts long id node to {@link SwhPID}. | ||||
* | * | ||||
* @param nodeId node specified as a long id | * @param nodeId node specified as a long id | ||||
* @return external SWH PID | * @return external SWH PID | ||||
* @see org.softwareheritage.graph.SwhId | * @see org.softwareheritage.graph.SwhPID | ||||
*/ | */ | ||||
public SwhId getSwhId(long nodeId) { | public SwhPID getSwhPID(long nodeId) { | ||||
return nodeIdMap.getSwhId(nodeId); | return nodeIdMap.getSwhPID(nodeId); | ||||
} | } | ||||
/** | /** | ||||
* Returns node type. | * Returns node type. | ||||
* | * | ||||
* @param nodeId node specified as a long id | * @param nodeId node specified as a long id | ||||
* @return corresponding node type | * @return corresponding node type | ||||
* @see org.softwareheritage.graph.Node.Type | * @see org.softwareheritage.graph.Node.Type | ||||
▲ Show 20 Lines • Show All 88 Lines • Show Last 20 Lines |