Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using labels as IDs #22

Open
jpfairbanks opened this issue Nov 29, 2022 · 0 comments
Open

Using labels as IDs #22

jpfairbanks opened this issue Nov 29, 2022 · 0 comments

Comments

@jpfairbanks
Copy link

I was just browsing the code and I noticed this function:

labeledPetri[:tname][i] = tuple(Symbol(outputName),Symbol(""))

It looks like you are trying to ensure that the labels are unique in order to use them as primary keys somewhere. I think the better options are:

  1. Use the positional ID which is guaranteed to be unique. There is always exactly 1 "n-th state" or "n-th transition". This satisfies your need for primary keys. It is actually better than guaranteeing that the ID is unique. The parts(X, :A) are always contiguously indexed in 1:nparts(X,:A).
  2. You are storing a tuple where the last element of the tuple is Symbol(""), this is probably going to bite you later since you will have elements of a tuple that don't mean anything. It would be better to make the label (X, i) rather than (Xi, ""). In general it is bad to pack structured data like "a pair with a symbol then a number" into a string. You are much better off representing that as Tuple{String, Int}.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant