Perhaps it's best to summarize what I have done so far so that people can advise how best to tweak it.

Dgraph consists of a library (which ideally should be considered a sourceLibrary) plus 3 executables that are simple test demos of the library's performance. I've got the library part building with the following package.json:

{
    "name": "dgraph",
    "description": "A library for creating, analysing and manipulating graphs (networks).  It aims to be fast and memory-efficient while also being easy to use and extend.",
    "authors": ["Joseph Rushton Wakeling"],
    "copyright": "Copyright © 2013 Joseph Rushton Wakeling",
    "homepage": "https://github.com/WebDrake/Dgraph",
    "license": "GPL-3.0 or later",
    "targetType": "library",
    "excludedSourceFiles": ["source/graphtest.d", "source/betweenness50.d", "source/betweenness10k.d"],
    "subPackages": [
        {
            "name": "dgraph-test",
            "targetType": "executable",
            "sourceFiles": ["source/graphtest.d"]
        },
        {
            "name": "dgraph-betweenness50",
            "targetType": "executable",
            "sourceFiles": ["source/betweenness50.d"]
        },
        {
            "name": "dgraph-betweenness10k",
            "targetType": "executable",
            "sourceFiles": ["source/betweenness10k.d"]
        }
    ]
}

Replacing "library" with "sourceLibrary", as previously mentioned, results in "Error: Assertion failure".

Issuing dub build with the above package.json results in the static library part being built without apparent problem as libdgraph.a. However, the executables don't build, and trying to force their being built manually by e.g. dub build dgraph:dgraph-test results in: "Error: Unknown build configuration: library".

I've tried adding a dependency on dgraph to the individual executables, which results in the following error message:

Failed to retrieve metadata for package dgraph: Could not find package candidate for dgraph ~master
Could not resolve dependencies
The dependency graph could not be filled, there are unresolved dependencies.
The following changes will be performed:
Failure dgraph ~master, userWide
Issued by: 
 dgraph:dgraph-test: ~master
Error: Unknown build configuration: library

I have tried adding "version": "~master" to package.json to resolve this, but the same error results. I've also tried the converse -- instead of adding a dgraph dependency to the executables, adding a dependency on the executables to dgraph, but the executables are still not built.

So, I think I'm about at the limits of faffing around without really understanding what I'm doing, and would really appreciate some advice on how to get this working. :-)