GraphBLAS / LAGraph-Working-Group

Public document and planning repository for the LAGraph Working Group
Other
3 stars 2 forks source link

Use GrB_Matrix/Vector or define LAGr_Matrix/Vector #6

Open mcmillan03 opened 4 years ago

mcmillan03 commented 4 years ago

One consideration, is carrying along property flags that can effect how algorithms are carried out:

GrB_Matrix + property flags --> LAGr_Matrix

jim22k commented 4 years ago

Example properties include:

jim22k commented 4 years ago

Properties should be discoverable, although doing so might require an expensive computation.

We should allow users to pass in the known value of properties to avoid computation.

ScottKolo commented 4 years ago

I see the crux of this issue being interoperability with GraphBLAS. If we go with LAGr_Matrix, we can no longer send that object directly to GraphBLAS without unpacking, even if it's just syntax (e.g. LAGr_Matrix_instance->GrB_Matrix_instance).

One solution is to provide user-visible wrappers for all GraphBLAS functions via LAGraph, something we already have to some degree to simplify error handling. This isn't true interoperability, but it would allow us to simplify the syntax to LAGr_GrBFn(LAGr_Matrix).

The added benefit to this approach would be that if there are any hints we can send along to GraphBLAS regarding this structure, we can handle it inside these wrappers.

I was against LAGr_Matrix/Vector at first, but it's growing on me.

DrTimothyAldenDavis commented 4 years ago

I'm also beginning to think that LAGraph_Matrix is the way to go. It could contain:

Having the transpose around can speed up certain algorithms.

We must allow for the user to set any properties at will. If they make a "mistake" we shouldn't correct them, but we should provide functions that compute the properties. Example where a user might want to flag a matrix as symmetric: say the user computes a matrix A that has type GrB_FP64, and the norm of A-A' is extremely small (order (roundoff)). The user might want to assert that A is symmetric, so that using A or A' has the same effect. A check for true symmetry could fail, but the user might want to assert that A should be treated as if symmetric, anyway.

On Mon, Apr 6, 2020 at 10:47 AM Scott Kolodziej notifications@github.com wrote:

I see the crux of this issue being interoperability with GraphBLAS. If we go with LAGr_Matrix, we can no longer send that object directly to GraphBLAS without unpacking, even if it's just syntax (e.g. LAGr_Matrix_instance->GrB_Matrix_instance).

One solution is to provide user-visible wrappers for all GraphBLAS functions via LAGraph, something we already have to some degree to simplify error handling. This isn't true interoperability, but it would allow us to simplify the syntax to LAGr_GrBFn(LAGr_Matrix).

The added benefit to this approach would be that if there are any hints we can send along to GraphBLAS regarding this structure, we can handle it inside these wrappers.

I was against LAGr_Matrix/Vector at first, but it's growing on me.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/GraphBLAS/LAGraph-Working-Group/issues/6#issuecomment-609875565, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEYIIONEC7HI3YFFHAA5A73RLH2QXANCNFSM4LZDCMEQ .

tgmattso commented 4 years ago

Decision: For now we are going to move forward and assume that we will have LAGraph objects that are opaque. We will move on in subsequent meetings and define function signatures for the library. That will let us write application-level code using LAGraph. We can then see if the opaqueness creates any problems and if needed revisit the issue.

Discussion:

We call it "GraphBLAS" but really its all about sparse linear algebra over algebraic semi-rings. There is surprisingly little Graph specific information we carry along with the objects. As we move to LAGraph, that is no longer the case. Now the GraphBLAS objects are specialized to graphs.

Hence, we need to know ... is this particular graphBLAS matrix, for example, an adjacency matrix or an incidence matrix. Is the graph undirected in which case the adjacency matrix is symmetric. Or do you have a directed graph but for a particular algorithm you want to treat it as undirected (i.e. a non symmetric matrix buy the algorithm will only use the upper or lower triangle). I could continue in this vein, but hopefully the point is clear; there is additional information we must carry with the GraphBLAS objects when they are used in LAGraph functions.

Hence, we need LAGraph objects. The next major decision is: are the LAGraph objects opaque or non opaque?

Pros for opaque objects:

Cons for opaque objects:

There are other pros and cons, but those are a few that stood out in our discussion. The point is we need to move forward in the design of LAGraph and then revisit questions of usability of the API in application-level code to make a final decision.

Another question that came up in the discussion was "what properties do we want to define in the LAGraph object"? It was suggested that we could analyze NetworkX (with 200 or so algorithms) and get some sense of the full set of properties we might need. The list might be short enough that we could realistically "get it done" once and for all in the definition of our objects (as opposed to picking a minimal set now and expanding it from one release of the spec to another)

tgmattso commented 4 years ago

Sorry. I closed the issue by mistake. I don't know if we want to mark this issues as closed or leave it open and close later after we revisit it.