public class CHStorage extends Object
This can be seen as an extension to a base graph: We assign a CH level to each node and add additional edges to the graph ('shortcuts'). The shortcuts need to be ordered in a certain way, but this is not enforced here.
Modifier and Type | Class and Description |
---|---|
static class |
CHStorage.LowWeightShortcut |
Constructor and Description |
---|
CHStorage(Directory dir,
String name,
int segmentSize,
boolean edgeBased) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
create(int nodes,
int expectedShortcuts)
Creates a new storage.
|
void |
debugPrint() |
void |
flush() |
static CHStorage |
fromGraph(BaseGraph baseGraph,
CHConfig chConfig) |
boolean |
getBwdAccess(long shortcutPointer) |
long |
getCapacity() |
boolean |
getFwdAccess(long shortcutPointer) |
int |
getLastShortcut(long nodePointer) |
int |
getLevel(long nodePointer) |
int |
getNodeA(long shortcutPointer) |
int |
getNodeB(long shortcutPointer) |
NodeOrderingProvider |
getNodeOrderingProvider() |
int |
getNodes()
The number of nodes of this storage.
|
int |
getNumShortcutsExceedingWeight() |
int |
getOrigEdgeKeyFirst(long shortcutPointer) |
int |
getOrigEdgeKeyLast(long shortcutPointer) |
int |
getShortcuts()
The number of shortcuts that were added to this storage
|
int |
getSkippedEdge1(long shortcutPointer) |
int |
getSkippedEdge2(long shortcutPointer) |
double |
getWeight(long shortcutPointer) |
boolean |
isClosed() |
boolean |
isEdgeBased() |
boolean |
loadExisting() |
void |
setLastShortcut(long nodePointer,
int shortcut) |
void |
setLevel(long nodePointer,
int level) |
void |
setLowShortcutWeightConsumer(Consumer<CHStorage.LowWeightShortcut> lowWeightShortcutConsumer)
Sets a callback called for shortcuts that are below the minimum weight.
|
void |
setOrigEdgeKeys(long shortcutPointer,
int origKeyFirst,
int origKeyLast) |
void |
setSkippedEdges(long shortcutPointer,
int edge1,
int edge2) |
void |
setWeight(long shortcutPointer,
double weight) |
int |
shortcutEdgeBased(int nodeA,
int nodeB,
int accessFlags,
double weight,
int skip1,
int skip2,
int origKeyFirst,
int origKeyLast) |
int |
shortcutNodeBased(int nodeA,
int nodeB,
int accessFlags,
double weight,
int skip1,
int skip2)
Adds a shortcut to the storage.
|
String |
toDetailsString() |
long |
toNodePointer(int node)
To use the node getters/setters you need to convert node IDs to a nodePointer first
|
long |
toShortcutPointer(int shortcut)
To use the shortcut getters/setters you need to convert shortcut IDs to an shortcutPointer first
|
public void setLowShortcutWeightConsumer(Consumer<CHStorage.LowWeightShortcut> lowWeightShortcutConsumer)
public void create(int nodes, int expectedShortcuts)
loadExisting()
}.
The number of nodes must be given here while the expected number of shortcuts can
be given to prevent some memory allocations, but is not a requirement. When in doubt rather use a small value
so the resulting files/byte arrays won't be unnecessarily large.
todo: we could also trim down the shortcuts DataAccess when we are done adding shortcutspublic void flush()
public boolean loadExisting()
public void close()
public int shortcutNodeBased(int nodeA, int nodeB, int accessFlags, double weight, int skip1, int skip2)
public int shortcutEdgeBased(int nodeA, int nodeB, int accessFlags, double weight, int skip1, int skip2, int origKeyFirst, int origKeyLast)
public int getNodes()
public int getShortcuts()
public long toNodePointer(int node)
public long toShortcutPointer(int shortcut)
public boolean isEdgeBased()
public int getLastShortcut(long nodePointer)
public void setLastShortcut(long nodePointer, int shortcut)
public int getLevel(long nodePointer)
public void setLevel(long nodePointer, int level)
public void setWeight(long shortcutPointer, double weight)
public void setSkippedEdges(long shortcutPointer, int edge1, int edge2)
public void setOrigEdgeKeys(long shortcutPointer, int origKeyFirst, int origKeyLast)
public int getNodeA(long shortcutPointer)
public int getNodeB(long shortcutPointer)
public boolean getFwdAccess(long shortcutPointer)
public boolean getBwdAccess(long shortcutPointer)
public double getWeight(long shortcutPointer)
public int getSkippedEdge1(long shortcutPointer)
public int getSkippedEdge2(long shortcutPointer)
public int getOrigEdgeKeyFirst(long shortcutPointer)
public int getOrigEdgeKeyLast(long shortcutPointer)
public NodeOrderingProvider getNodeOrderingProvider()
public void debugPrint()
public long getCapacity()
public int getNumShortcutsExceedingWeight()
public String toDetailsString()
public boolean isClosed()
Copyright © 2012–2022. All rights reserved.