While mapping a relational OO model, I came across a scenario wherein it is required to maintain a One-to-One relation between vertices.
Is it possible to restrict the cardinality of edges using labels in AWS Neptune the way it is done from Vertex Properties?
Well, this would be quite helpful when there is an update in the relationship.
As it stands today, the only constraints for Property Graph provided by Neptune include:
Each vertex/edge must have a unique ID that is global to the full set of vertices and the full set of edges. IDs can be any string value.
Each vertex and edge must have a label. If you don't supply one, a vertex is given a label of "vertex" and an edge is given a label of "edge".
Properties on vertices can be either sets or of single cardinality. Edge properties, on the other hand, can only be of single cardinality.
Related
I have multiple geometries (D3D12_RAYTRACING_GEOMETRY_DESC) inside of a single DXR bottom level acceleration structure (BLAS). How can I determine which of those was hit inside of a closest hit shader?
The following HLSL intrinsics do something different:
PrimitiveIndex() returns the triangle index for the current geometry, but it restarts for each new geometry inside of the BLAS, so I don't know which one was hit.
InstanceIndex() returns the index of the top level but not of the bottom level
InstanceID() again, is only defined for the top level
Starting with D3D12_RAYTRACING_TIER_1_1 there is a new intrinsic called uint GeometryIndex() Specification.
I am wondering about that as well. Unfortunately, I can't give you a definitive answer but on this page I found the following statement:
Since hit groups need information about the geometry that was hit –
its vertex data and material properties – you typically need a local
root table for them. To avoid passing data through the local root
table, you may also use the instance id field in the top-level
instance descriptor and utilize the instance index, which are
implicitly available in the hit group shaders. Remember, though, that
these values are shared between all geometries in the instance when
the bottom level structure contains more than one geometry. To have
unique data for each geometry, a local root table must be used.
So if I understood that correctly, you either have to use a local root table or you have to restrict yourself to only one geometry per bottom level structure.
There is a MultiplierForGeometryContributionToShaderIndex parameter in TraceRay which you can set to 1 to get a different hit group per geometry. If you store a list of materials per hit group, you probably need only one hit group per geometry.
See also RaytracingMiniEngineSample.
I have gone through BGL documentation and I'm trying to construct a directed graph with the properties below. Even though the documentation mentions bits and pieces, I can't seem to understand how to achieve these properties collectively through BGL. The properties I'm looking for are:
O(1) access to vertices with some integer/string as key
O(I) access to incoming or outgoing edges where I is the number of incident edges, i.e. through an adjacency list (O(1) access to edges would be cool, as well, through some key)
Able to change multiple edge properties, i.e. weight, id, attached Custom data struct
Able to change multiple vertex properties, i.e. id, attached Custom data structures
Add/Remove Vertices and Edges
Is there a way to construct a graph through BGL, with all of these properties? A code sample would be appreciated.
I'm trying to figure out how to best model my data in my TSL. In the Friends example, relationships are implied by storing the cell id (or a List of cell ids) in the related nodes. In the Freebase example, though, there's the notion of a [GraphEdge] that's introduced. I was hoping the documentation (and perhaps here), we could get a clear understanding of how to properly model relationships/edges using GraphEngine.
To my knowledge, there is no such standard way according to the documents, and the best practice also depends on our own requirements, e.g., performance or convenience. Here are my choices in different situations:
For a directed unlabeled graph which is a very common situation, I just use neighbors' cell ids (adjacency list) as a field. And I find it is very efficient for most graph operations;
For a directed graph with properties on the edges, there are two choices: use a list of values of self-defined struct, or set an individual cell for the edges and connecting the edges to the source/target node cells. The former one is practically faster than the latter one for most graph operations. But the cost is that it does not allow to access an edge without visiting the node cell, which is the benefit of the latter one;
For an undirected graph without properties on edges, for each edge (u, v), I place their cell ids in each other's adjacency lists;
For an undirected graph with properties on edges, a separate edge cell is set up for each edge, storing all the information on it including the associated nodes and properties;
For a hypergraph where an edge may connecting more than one nodes, my choice is the same as 4.
The introduced notion [GraphEdge] is used to recognize the edges by Language Integrated Knowledge Query (LIKQ), however, it will not affect our usages if our applications are not built on top of LIKQ.
I have a graph representing a route network - waypoints are vertices and routes are edges. The problem is that there might be regions in between waypoints which cannot be crossed during certain periods. But those regions don't necessarily affect vertices but only edges.
I use time as cost function, so for each vertex (and thus edge) I can get the time of arrival within visitors and/or heuristic. However, as the weightmap is readable, I cannot change the weight of an edge to make it "too long".
On the other hand I cannot create a custom weightmap as I don't know the time of arrival in advance as it depends on the path.
What I found up to know in the forum is to use the heuristic and to set it to inf in case of a "bad" vertex. But what I would need is to select "bad" edges.
Do you have an idea about accessing the currently examined edge within the heuristic (by default its only input is vertex descriptor)?
I know that I could make decisions in the examine_edge visitor , but what should I call in it to let astar know that this edge is bad, and shouldn't be used? Maybe I could create an external boolean "bad edge" property map (for all vertices) and if the current edge is "bad" set the target vertex to true within the examine_edge visitor? This "bad edge" property map could then be accessed by the heuristics.
However, it seems to me that this might not be the best solution.
Any other idea?
Thanks in advance!
A common approach to solving problems like these is to build a new graph whose nodes contain more information than the original nodes. In your case, consider creating a graph with multiple copies of each node, one per different time instant possible. Then, have each edge go between a pair of nodes if there was an edge between the corresponding nodes at the appropriate points in time. For example, edges that are always open will take you from a node at one time point to the corresponding node at a later time point, and edges that are only active at a certain point in time will only be in the graph at those time points.
This has the disadvantage of blowing up the size of the graph, but if you have the option of lazily evaluating the graph this approach might be quite reasonable.
I am using BGL recently, and I have a graph G now. I need a data structure that can rule out one vertex at a time, without breaking the original graph. What should I do?
At first I found the filtered graph, but I need to label all vertices, and create a new filtered graph after I rule out a vertex. If I have N vertices in the graph, I need to filter N times.
I also thought of a subgraph, but it doesn't support removing vertices.
You can use a filtered graph.
You can have a dynamic filter predicate that incrementally filters out more vertices. No need to create more filtered graphs at all.
See an example:
Using two objects as hash key for an unordered_map or alternatives
boost graph copy and removing vertex
Remove 100,000+ nodes from a Boost graph