Skip to main content
Commonmark migration
Source Link

Jelly,  18 16  15 bytes

Assumes self-connections may be any weight (i.e. they are not necessarily only either \$0\$ or the equal weight).

Jœcṗ2EÐḟœị³EƲ€S 

Try it online!
the two subsets of size 3 being ACE and BCD
With n=2 all 10 subsets of size 2 work as its symmetric.

How?

Jœcṗ2EÐḟœị³EƲ€S - Link: list of lists of integers, M; integer, n J - range of length of M = [1,2,3,...,length(M)] œc - Combinations of length n e.g. [[1,2,3],[1,2,4],[1,3,4],[2,3,4]] € - for each: Ʋ - last four links as a monad: ṗ2 - Cartesian power with 2 Ðḟ - discard if: E - all-equal (i.e. diagonal co-ordinates like [3,3]) œị - multi-dimensional index into: ³ - program's 3rd argument (1st input), M E - all equal? S - sum 

Jelly,  18 16  15 bytes

Assumes self-connections may be any weight (i.e. they are not necessarily only either \$0\$ or the equal weight).

Jœcṗ2EÐḟœị³EƲ€S 

Try it online!
the two subsets of size 3 being ACE and BCD
With n=2 all 10 subsets of size 2 work as its symmetric.

How?

Jœcṗ2EÐḟœị³EƲ€S - Link: list of lists of integers, M; integer, n J - range of length of M = [1,2,3,...,length(M)] œc - Combinations of length n e.g. [[1,2,3],[1,2,4],[1,3,4],[2,3,4]] € - for each: Ʋ - last four links as a monad: ṗ2 - Cartesian power with 2 Ðḟ - discard if: E - all-equal (i.e. diagonal co-ordinates like [3,3]) œị - multi-dimensional index into: ³ - program's 3rd argument (1st input), M E - all equal? S - sum 

Jelly,  18 16  15 bytes

Assumes self-connections may be any weight (i.e. they are not necessarily only either \$0\$ or the equal weight).

Jœcṗ2EÐḟœị³EƲ€S 

Try it online!
the two subsets of size 3 being ACE and BCD
With n=2 all 10 subsets of size 2 work as its symmetric.

How?

Jœcṗ2EÐḟœị³EƲ€S - Link: list of lists of integers, M; integer, n J - range of length of M = [1,2,3,...,length(M)] œc - Combinations of length n e.g. [[1,2,3],[1,2,4],[1,3,4],[2,3,4]] € - for each: Ʋ - last four links as a monad: ṗ2 - Cartesian power with 2 Ðḟ - discard if: E - all-equal (i.e. diagonal co-ordinates like [3,3]) œị - multi-dimensional index into: ³ - program's 3rd argument (1st input), M E - all equal? S - sum 
deleted 31 characters in body
Source Link
Jonathan Allan
  • 115.5k
  • 8
  • 68
  • 293

Jelly,  18 16  15 bytes

Assumes self-connections may be any weight (i.e. they are not necessarily only either \$0\$ or the equal weight).

Jœcṗ2EÐḟœị³EƲ€S 

Try it online!
the two subsets of size 3 being ACE and BCD
With n=2 all 10 subsets of size 2 work as its symmetric.

How?

Updating...

Jœcṗ€2EÐḟ€œị⁸E€SJœcṗ2EÐḟœị³EƲ€S - Link: list of lists of integers, M; integer, n J  - range of length of M = [1,2,3,...,length(M)] œc  - Combinations of length n e.g. [[1,2,3],[1,2,4],[1,3,4],[2,3,4]]     - for each:  2 Ʋ - Cartesianlast powerfour withlinks 2 as a monad:  ṗ2  - for each:  Cartesian power with 2  Ðḟ -  discard if:   E -  all-equal (i.e. diagonal co-ordinates like [3,3])   œị  -  multi-dimensional index into (vectorises): ³  - chain's left argument, M  program's 3rd argument -(1st forinput), each:M   E  -  all equal?   S - sum 

Jelly,  18 16  15 bytes

Assumes self-connections may be any weight (i.e. they are not necessarily only either \$0\$ or the equal weight).

Jœcṗ2EÐḟœị³EƲ€S 

Try it online!
the two subsets of size 3 being ACE and BCD
With n=2 all 10 subsets of size 2 work as its symmetric.

How?

Updating...

Jœcṗ€2EÐḟ€œị⁸E€S - Link: list of lists of integers, M; integer, n J  - range of length of M = [1,2,3,...,length(M)] œc  - Combinations of length n e.g. [[1,2,3],[1,2,4],[1,3,4],[2,3,4]]    - for each:  2 - Cartesian power with 2   - for each:  Ðḟ - discard if:   E - all-equal (i.e. diagonal co-ordinates like [3,3])   œị - multi-dimensional index into (vectorises):  - chain's left argument, M   - for each:   E - all equal?   S - sum 

Jelly,  18 16  15 bytes

Assumes self-connections may be any weight (i.e. they are not necessarily only either \$0\$ or the equal weight).

Jœcṗ2EÐḟœị³EƲ€S 

Try it online!
the two subsets of size 3 being ACE and BCD
With n=2 all 10 subsets of size 2 work as its symmetric.

How?

Jœcṗ2EÐḟœị³EƲ€S - Link: list of lists of integers, M; integer, n J - range of length of M = [1,2,3,...,length(M)] œc - Combinations of length n e.g. [[1,2,3],[1,2,4],[1,3,4],[2,3,4]]  - for each: Ʋ - last four links as a monad:  ṗ2 - Cartesian power with 2  Ðḟ -  discard if: E -  all-equal (i.e. diagonal co-ordinates like [3,3]) œị  -  multi-dimensional index into: ³ - program's 3rd argument (1st input), M E  -  all equal? S - sum 
added 19 characters in body
Source Link
Jonathan Allan
  • 115.5k
  • 8
  • 68
  • 293

Jelly,  18 16  1615 bytes

Assumes self-connections may be any weight (i.e. they are not necessarily only either \$0\$ or the equal weight).

Jœcṗ€2EÐḟ€œị⁸E€SJœcṗ2EÐḟœị³EƲ€S 

Try it online!Try it online!
the two subsets of size 3 being ACE and BCD
With n=2With n=2 all 10 subsets of size 2 work as its symmetric.

How?

Updating...

Jœcṗ€2EÐḟ€œị⁸E€S - Link: list of lists of integers, M; integer, n J - range of length of M = [1,2,3,...,length(M)] œc - Combinations of length n e.g. [[1,2,3],[1,2,4],[1,3,4],[2,3,4]] € - for each: ṗ 2 - Cartesian power with 2 € - for each: Ðḟ - discard if: E - all-equal (i.e. diagonal co-ordinates like [3,3]) œị - multi-dimensional index into (vectorises): ⁸ - chain's left argument, M € - for each: E - all equal? S - sum 

Jelly,  18  16 bytes

Assumes self-connections may be any weight (i.e. they are not necessarily only either \$0\$ or the equal weight).

Jœcṗ€2EÐḟ€œị⁸E€S 

Try it online!
the two subsets of size 3 being ACE and BCD
With n=2 all 10 subsets of size 2 work as its symmetric.

How?

Jœcṗ€2EÐḟ€œị⁸E€S - Link: list of lists of integers, M; integer, n J - range of length of M = [1,2,3,...,length(M)] œc - Combinations of length n e.g. [[1,2,3],[1,2,4],[1,3,4],[2,3,4]] € - for each: ṗ 2 - Cartesian power with 2 € - for each: Ðḟ - discard if: E - all-equal (i.e. diagonal co-ordinates like [3,3]) œị - multi-dimensional index into (vectorises): ⁸ - chain's left argument, M € - for each: E - all equal? S - sum 

Jelly,  18 16  15 bytes

Assumes self-connections may be any weight (i.e. they are not necessarily only either \$0\$ or the equal weight).

Jœcṗ2EÐḟœị³EƲ€S 

Try it online!
the two subsets of size 3 being ACE and BCD
With n=2 all 10 subsets of size 2 work as its symmetric.

How?

Updating...

Jœcṗ€2EÐḟ€œị⁸E€S - Link: list of lists of integers, M; integer, n J - range of length of M = [1,2,3,...,length(M)] œc - Combinations of length n e.g. [[1,2,3],[1,2,4],[1,3,4],[2,3,4]] € - for each: ṗ 2 - Cartesian power with 2 € - for each: Ðḟ - discard if: E - all-equal (i.e. diagonal co-ordinates like [3,3]) œị - multi-dimensional index into (vectorises): ⁸ - chain's left argument, M € - for each: E - all equal? S - sum 
added 29 characters in body
Source Link
Jonathan Allan
  • 115.5k
  • 8
  • 68
  • 293
Loading
added 29 characters in body
Source Link
Jonathan Allan
  • 115.5k
  • 8
  • 68
  • 293
Loading
deleted 9 characters in body
Source Link
Jonathan Allan
  • 115.5k
  • 8
  • 68
  • 293
Loading
added 21 characters in body
Source Link
Jonathan Allan
  • 115.5k
  • 8
  • 68
  • 293
Loading
added 21 characters in body
Source Link
Jonathan Allan
  • 115.5k
  • 8
  • 68
  • 293
Loading
Source Link
Jonathan Allan
  • 115.5k
  • 8
  • 68
  • 293
Loading